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

Method constructor

tfjs-backend-webgl/src/tile_gpu.ts:27–43  ·  view source on GitHub ↗
(aShape: number[], reps: number[])

Source from the content-addressed store, hash-verified

25 rank: number;
26
27 constructor(aShape: number[], reps: number[]) {
28 const outputShape: number[] = new Array(aShape.length);
29 for (let i = 0; i < outputShape.length; i++) {
30 outputShape[i] = aShape[i] * reps[i];
31 }
32 this.outputShape = outputShape;
33 this.rank = outputShape.length;
34 const dtype = getCoordsDataType(this.rank);
35 const sourceCoords = getSourceCoords(aShape);
36
37 this.userCode = `
38 void main() {
39 ${dtype} resRC = getOutputCoords();
40 setOutput(getA(${sourceCoords}));
41 }
42 `;
43 }
44}
45
46function getSourceCoords(aShape: number[]): string {

Callers

nothing calls this directly

Calls 2

getCoordsDataTypeFunction · 0.90
getSourceCoordsFunction · 0.70

Tested by

no test coverage detected