license import { KernelConfig , Reshape , ReshapeAttrs , ReshapeInputs , tensor1d } from '@tensorflow/tfjs' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; export const reshapeConfig = { kernelName : Reshape , backendName : 'tensorflow' , kernelFunc : ( args ) => { const { x } = args . inputs as ReshapeInputs ; const backend = args . backend as NodeJSKernelBackend ; const { shape } = args . attrs as { } as ReshapeAttrs ; const shapeTensor = tensor1d ( shape , 'int32' ) ; const opAttrs = [ createTensorsTypeOpAttr ( 'T' , x . dtype ) , createTensorsTypeOpAttr ( 'Tshape' , shapeTensor . dtype ) ] ; const res = backend . executeSingleOutput ( Reshape , opAttrs , [ x , shapeTensor ] ) ; shapeTensor . dispose ( ) ; return res ; } } ;