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

Method constructor

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

getCoordsDataTypeFunction · 0.90
getSwitchedCoordsFunction · 0.70

Tested by

no test coverage detected