license import { backend_util , Conv2DBackpropFilter , Conv2DBackpropFilterAttrs , Conv2DBackpropFilterInputs , KernelConfig , KernelFunc } from '@tensorflow/tfjs-core' ; import { MathBackendWebGL } from '../backend_webgl' ; import { Conv2DDerFilterProgram } from '../conv_backprop_gpu' ; export function conv2DBackpropFilter ( args ) { const { inputs , backend , attrs } = args ; const { x , dy } = inputs ; const { strides , pad , dataFormat , dimRoundingMode , filterShape } = attrs ; const $dataFormat = backend_util . convertConv2DDataFormat ( dataFormat ) ; const convInfo = backend_util . computeConv2DInfo ( x . shape as [ number , number , number , number ] , filterShape , strides , 1 , pad , dimRoundingMode , false , $dataFormat ) ; const program = new Conv2DDerFilterProgram ( convInfo ) ; return backend . runWebGLProgram ( program , [ x , dy ] , 'float32' ) ; } export const conv2DBackpropFilterConfig = { kernelName : Conv2DBackpropFilter , backendName : 'webgl' , kernelFunc : conv2DBackpropFilter as { } as KernelFunc , } ;