(xShape: number[], radius: number)
| 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 = ` |
nothing calls this directly
no test coverage detected