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

Method constructor

tfjs-backend-webgpu/src/mirror_pad_webgpu.ts:33–48  ·  view source on GitHub ↗
(
      xShape: number[], paddings: Array<[number, number]>,
      mode: 'reflect'|'symmetric')

Source from the content-addressed store, hash-verified

31 size = true;
32
33 constructor(
34 xShape: number[], paddings: Array<[number, number]>,
35 mode: 'reflect'|'symmetric') {
36 this.outputShape = paddings.map(
37 (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);
38 this.dispatchLayout = flatDispatchLayout(this.outputShape);
39 this.dispatch = computeDispatch(
40 this.dispatchLayout, this.outputShape, this.workgroupSize);
41
42 this.xShape = xShape;
43 paddings.map((_, i) => {
44 this.uniforms += ` pad${i} : vec2<i32>,`;
45 });
46 this.offset = mode === 'reflect' ? 0 : 1;
47 this.shaderKey = `mirrorPad_${mode}`;
48 }
49
50 getUserCode(): string {
51 const rank = this.xShape.length;

Callers

nothing calls this directly

Calls 2

flatDispatchLayoutFunction · 0.90
computeDispatchFunction · 0.90

Tested by

no test coverage detected