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

Method constructor

tfjs-backend-webgl/src/unpack_gpu.ts:30–49  ·  view source on GitHub ↗
(outputShape: number[])

Source from the content-addressed store, hash-verified

28 enableShapeUniforms: boolean;
29
30 constructor(outputShape: number[]) {
31 this.outputShape = outputShape;
32 this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);
33 const rank = outputShape.length;
34
35 const channels = getChannels('rc', rank);
36 const dtype = getCoordsDataType(rank);
37 const sourceCoords = getSourceCoords(rank, channels);
38 const innerDims = channels.slice(-2);
39 const coords = rank <= 1 ? 'rc' : `vec2(${innerDims.join(',')})`;
40
41 this.userCode = `
42 void main() {
43 ${dtype} rc = getOutputCoords();
44 vec4 packedInput = getA(${sourceCoords});
45
46 setOutput(getChannel(packedInput, ${coords}));
47 }
48 `;
49 }
50}

Callers

nothing calls this directly

Calls 6

useShapeUniformsFunction · 0.90
getChannelsFunction · 0.90
getCoordsDataTypeFunction · 0.90
getSourceCoordsFunction · 0.90
joinMethod · 0.80
sliceMethod · 0.65

Tested by

no test coverage detected