license import { Cast , CastAttrs , CastInputs , KernelConfig } from '@tensorflow/tfjs' ; import { createTensorsTypeOpAttr , NodeJSKernelBackend } from '../nodejs_kernel_backend' ; export const castConfig = { kernelName : Cast , backendName : 'tensorflow' , kernelFunc : ( args ) => { const { x } = args . inputs as CastInputs ; const backend = args . backend as NodeJSKernelBackend ; const { dtype } = args . attrs as { } as CastAttrs ; const opAttrs = [ createTensorsTypeOpAttr ( 'SrcT' , x . dtype ) , createTensorsTypeOpAttr ( 'DstT' , dtype ) , { name : 'Truncate' , type : backend . binding . TF_ATTR_BOOL , value : false } ] ; return backend . executeSingleOutput ( Cast , opAttrs , [ x ] ) ; } } ;