license import { DepthToSpace , DepthToSpaceAttrs , DepthToSpaceInputs , KernelConfig , Tensor } from '@tensorflow/tfjs' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; export const depthToSpaceConfig = { kernelName : DepthToSpace , backendName : 'tensorflow' , kernelFunc : ( args ) => { const { x } = args . inputs as DepthToSpaceInputs ; const backend = args . backend as NodeJSKernelBackend ; const { blockSize , dataFormat } = args . attrs as { } as DepthToSpaceAttrs ; const opAttrs = [ createTensorsTypeOpAttr ( 'T' , x as Tensor ) , { name : 'block_size' , type : backend . binding . TF_ATTR_INT , value : blockSize < 2 ? 2 : blockSize } , { name : 'data_format' , type : backend . binding . TF_ATTR_STRING , value : dataFormat } ] ; const inputs = [ x ] ; return backend . executeSingleOutput ( DepthToSpace , opAttrs , inputs ) ; } } ;