license import { backend_util , Dilation2DAttrs , Dilation2DBackpropFilter , Dilation2DBackpropFilterInputs , KernelConfig } from '@tensorflow/tfjs' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; export const dilation2dBackpropFilterConfig = { kernelName : Dilation2DBackpropFilter , backendName : 'tensorflow' , kernelFunc : ( { inputs , backend , attrs } ) => { const { x , filter , dy } = inputs as Dilation2DBackpropFilterInputs ; const { strides , pad , dilations } = attrs as { } as Dilation2DAttrs ; const { dilationHeight , dilationWidth , padInfo , strideHeight , strideWidth } = backend_util . computeDilation2DInfo ( x . shape as [ number , number , number , number ] , filter . shape as [ number , number , number ] , strides , pad , 'NHWC' , dilations ) ; const $strides = [ 1 , strideHeight , strideWidth , 1 ] ; const $dilations = [ 1 , dilationHeight , dilationWidth , 1 ] ; const nodeBackend = backend as NodeJSKernelBackend ; const opAttrs = [ createTensorsTypeOpAttr ( 'T' , x . dtype ) , { name : 'strides' , type : nodeBackend . binding . TF_ATTR_INT , value : $strides } , { name : 'rates' , type : nodeBackend . binding . TF_ATTR_INT , value : $dilations } , { name : 'padding' , type : nodeBackend . binding . TF_ATTR_STRING , value : padInfo . type } ] ; return nodeBackend . executeSingleOutput ( Dilation2DBackpropFilter , opAttrs , [ x , filter , dy ] ) ; } } ;