(args: {
inputs: MaxPool3DGradInputs,
backend: MathBackendWebGL,
attrs: MaxPool3DGradAttrs
})
| 21 | import {Pool3DProgram} from '../pool_gpu'; |
| 22 | |
| 23 | export function maxPool3DGrad(args: { |
| 24 | inputs: MaxPool3DGradInputs, |
| 25 | backend: MathBackendWebGL, |
| 26 | attrs: MaxPool3DGradAttrs |
| 27 | }): TensorInfo { |
| 28 | const {inputs, backend, attrs} = args; |
| 29 | const {dy, input} = inputs; |
| 30 | const x = input; |
| 31 | const {filterSize, strides, pad, dimRoundingMode} = attrs; |
| 32 | const dilations: [number, number, number] = [1, 1, 1]; |
| 33 | |
| 34 | const convInfo = backend_util.computePool3DInfo( |
| 35 | x.shape as [number, number, number, number, number], filterSize, strides, |
| 36 | dilations, pad, dimRoundingMode); |
| 37 | |
| 38 | const maxPool3dPositionsProgram = |
| 39 | new Pool3DProgram(convInfo, 'max', true /* get positions */); |
| 40 | const maxPool3dPositions = |
| 41 | backend.runWebGLProgram(maxPool3dPositionsProgram, [x], x.dtype); |
| 42 | const maxPoolBackpropProgram = new MaxPool3DBackpropProgram(convInfo); |
| 43 | const result = backend.runWebGLProgram( |
| 44 | maxPoolBackpropProgram, [dy, maxPool3dPositions], x.dtype); |
| 45 | backend.disposeIntermediateTensorInfo(maxPool3dPositions); |
| 46 | return result; |
| 47 | } |
| 48 | |
| 49 | export const maxPool3DGradConfig: KernelConfig = { |
| 50 | kernelName: MaxPool3DGrad, |
nothing calls this directly
no test coverage detected
searching dependent graphs…