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

Function maxPoolGrad

tfjs-backend-wasm/src/kernels/MaxPoolGrad.ts:52–88  ·  view source on GitHub ↗
(args: {
  inputs: MaxPoolGradInputs,
  attrs: MaxPoolGradAttrs,
  backend: BackendWasm,
})

Source from the content-addressed store, hash-verified

50}
51
52export function maxPoolGrad(args: {
53 inputs: MaxPoolGradInputs,
54 attrs: MaxPoolGradAttrs,
55 backend: BackendWasm,
56}): TensorInfo {
57 const {inputs, backend, attrs} = args;
58 const {dy, input} = inputs;
59 const {filterSize, strides, pad, dimRoundingMode} = attrs;
60
61 const convInfo = backend_util.computePool2DInfo(
62 input.shape as [number, number, number, number], filterSize, strides,
63 /*dilations=*/1, pad, dimRoundingMode);
64 const dx = backend.makeOutput(input.shape, input.dtype);
65
66 wasmMaxPoolGrad(
67 backend.dataIdMap.get(input.dataId).id,
68 backend.dataIdMap.get(dy.dataId).id,
69 backend.dataIdMap.get(dx.dataId).id,
70 convInfo.batchSize,
71 // Since Pool ops (MaxPool and MaxPool) support 2D filter only, in
72 // channels should always equal to out channels.
73 /*channelSize=*/convInfo.inChannels,
74 convInfo.inHeight,
75 convInfo.inWidth,
76 convInfo.outHeight,
77 convInfo.outWidth,
78 convInfo.strideHeight,
79 convInfo.strideWidth,
80 convInfo.dilationHeight,
81 convInfo.dilationWidth,
82 convInfo.effectiveFilterHeight,
83 convInfo.effectiveFilterWidth,
84 convInfo.padInfo.top,
85 convInfo.padInfo.left,
86 );
87 return dx;
88}
89
90export const maxPoolGradConfig: KernelConfig = {
91 kernelName: MaxPoolGrad,

Callers

nothing calls this directly

Calls 2

makeOutputMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…