MCPcopy Create free account
hub / github.com/tensorflow/tfjs / constructor

Method constructor

tfjs-backend-webgl/src/gather_gpu.ts:29–43  ·  view source on GitHub ↗
(aShape: GatherShape, outputShape: GatherShape)

Source from the content-addressed store, hash-verified

27 rank: number;
28
29 constructor(aShape: GatherShape, outputShape: GatherShape) {
30 this.outputShape = outputShape;
31 this.rank = outputShape.length;
32 const dtype = getCoordsDataType(this.rank);
33 const sourceCoords = getSourceCoords(aShape, 2);
34
35 this.userCode = `
36 void main() {
37 ${dtype} resRC = getOutputCoords();
38 int index = int(getIndices(resRC.x, resRC.z));
39 float inBounds = (index >= 0) && (index < ${aShape[2]}) ? 1.0 : 0.0;
40 setOutput(inBounds * getA(${sourceCoords}));
41 }
42 `;
43 }
44}
45
46// The input and output are always flattened into rank 4 tensors.

Callers

nothing calls this directly

Calls 2

getCoordsDataTypeFunction · 0.90
getSourceCoordsFunction · 0.70

Tested by

no test coverage detected