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

Method constructor

tfjs-backend-webgpu/src/lrn_webgpu.ts:92–108  ·  view source on GitHub ↗
(xShape: number[], radius: number)

Source from the content-addressed store, hash-verified

90 elementsPerWorkgroup: number;
91
92 constructor(xShape: number[], radius: number) {
93 util.assert(
94 radius <= this.maxAllowRadius,
95 () => `Radius must be less than or equal to ${
96 this.maxAllowRadius}, current radius is ${radius}`);
97
98 this.outputShape = xShape;
99 // The reason why not using this.workgroupSize[0] + 2 * maxAllowRadius here
100 // is to make sure that there is only one time global memory load access for
101 // each thread.
102 this.elementsPerWorkgroup = this.workgroupSize[0] - 2 * this.maxAllowRadius;
103 this.dispatchLayout = {x: [3], y: [2], z: [0, 1]};
104 this.dispatch = computeDispatch(this.dispatchLayout, this.outputShape, [
105 this.elementsPerWorkgroup, this.workgroupSize[1], this.workgroupSize[2]
106 ]);
107 this.shaderKey = 'lrn_shared';
108 }
109
110 getUserCode(): string {
111 const userCode = `

Callers

nothing calls this directly

Calls 1

computeDispatchFunction · 0.90

Tested by

no test coverage detected