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

Function getSourceCoords

tfjs-backend-webgpu/src/tile_webgpu.ts:59–73  ·  view source on GitHub ↗
(rank: number, uniformPrefix = '')

Source from the content-addressed store, hash-verified

57}
58
59function getSourceCoords(rank: number, uniformPrefix = ''): string {
60 if (rank >= 5) {
61 throw Error(`Tile for rank ${rank} is not yet supported`);
62 }
63 if (rank === 1) {
64 return `(resRC % ${uniformPrefix}aShape)`;
65 }
66
67 const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];
68 const sourceCoords = [];
69 for (let i = 0; i < rank; i++) {
70 sourceCoords.push(`(${currentCoords[i]} % ${uniformPrefix}aShape[${i}])`);
71 }
72 return sourceCoords.join();
73}

Callers 1

getUserCodeMethod · 0.70

Calls 3

ErrorFunction · 0.85
joinMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…