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

Method getUserCode

tfjs-backend-webgpu/src/gather_webgpu.ts:41–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39 }
40
41 getUserCode(): string {
42 const sourceCoords = getSourceCoords(this.aShape);
43 const userCode = `
44 ${main('index')} {
45 if (index < uniforms.size) {
46 let resRC = getCoordsFromIndex(index);
47 let indexZ = i32(getIndices(resRC.x, resRC.z));
48 let inBounds = select(0.0, 1.0, indexZ >= 0 && indexZ < uniforms.aShape[2]);
49 setOutputAtIndex(index, inBounds * getA(${sourceCoords}));
50 }
51 }
52 `;
53 return userCode;
54 }
55}
56
57// The input and output are always flattened into rank 4 tensors.

Callers

nothing calls this directly

Calls 2

getSourceCoordsFunction · 0.70
mainFunction · 0.50

Tested by

no test coverage detected