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

Method constructor

tfjs-backend-webgpu/src/rotate_webgpu.ts:32–53  ·  view source on GitHub ↗
(
      imageShape: [number, number, number, number],
      fillValue: number|[number, number, number])

Source from the content-addressed store, hash-verified

30 size = true;
31
32 constructor(
33 imageShape: [number, number, number, number],
34 fillValue: number|[number, number, number]) {
35 this.outputShape = imageShape;
36 this.dispatchLayout = flatDispatchLayout(this.outputShape);
37 this.dispatch = computeDispatch(
38 this.dispatchLayout, this.outputShape, this.workgroupSize);
39 this.uniforms = `centerX : f32, centerY : f32, sinRadians : f32,
40 cosRadians : f32,`;
41 this.shaderKey = 'rotate';
42 this.outputShape = imageShape;
43
44 if (typeof fillValue === 'number') {
45 this.uniforms += ` fillValue : f32,`;
46 this.fillSnippet = `var outputValue = uniforms.fillValue;`;
47 this.shaderKey += '_float';
48 } else {
49 this.uniforms += ` fillValue : vec3<f32>,`;
50 this.fillSnippet = `var outputValue = uniforms.fillValue[coords[3]];`;
51 this.shaderKey += '_vec3';
52 }
53 }
54
55 getUserCode(): string {
56 const userCode = `

Callers

nothing calls this directly

Calls 2

flatDispatchLayoutFunction · 0.90
computeDispatchFunction · 0.90

Tested by

no test coverage detected