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

Method constructor

tfjs-backend-webgpu/src/pool_webgpu.ts:39–58  ·  view source on GitHub ↗
(
      convInfo: backend_util.Conv2DInfo, poolType: 'max'|'avg',
      computePositions = false, flattenPositions = false,
      includeBatchIndex = false)

Source from the content-addressed store, hash-verified

37 includeBatchIndex: boolean;
38
39 constructor(
40 convInfo: backend_util.Conv2DInfo, poolType: 'max'|'avg',
41 computePositions = false, flattenPositions = false,
42 includeBatchIndex = false) {
43 if (poolType === 'avg' && computePositions) {
44 throw new Error('Cannot compute positions for average pool.');
45 }
46
47 this.outputShape = convInfo.outShape;
48 this.dispatchLayout = flatDispatchLayout(this.outputShape);
49 this.dispatch = computeDispatch(
50 this.dispatchLayout, this.outputShape, this.workgroupSize);
51
52 this.poolType = poolType;
53 this.computePositions = computePositions;
54 this.flattenPositions = flattenPositions;
55 this.includeBatchIndex = includeBatchIndex;
56 this.shaderKey = `pool2D_${poolType}_${computePositions}_${
57 flattenPositions}_${includeBatchIndex}`;
58 }
59
60 getUserCode(): string {
61 let updateSnippet: string;

Callers

nothing calls this directly

Calls 2

flatDispatchLayoutFunction · 0.90
computeDispatchFunction · 0.90

Tested by

no test coverage detected