license import { Complex , ComplexInputs , KernelConfig , KernelFunc , TensorInfo , TypedArray } from '@tensorflow/tfjs-core' ; import { MathBackendCPU } from '../backend_cpu' ; export function complex ( args ) { const { inputs , backend } = args ; const { real , imag } = inputs ; const realVals = backend . data . get ( real . dataId ) . values as TypedArray ; const imagVals = backend . data . get ( imag . dataId ) . values as TypedArray ; const complexInfo = backend . makeTensorInfo ( real . shape , 'complex64' ) ; const complex = backend . data . get ( complexInfo . dataId ) ; complex . complexTensorInfos = { real : backend . makeTensorInfo ( real . shape , 'float32' , realVals ) , imag : backend . makeTensorInfo ( imag . shape , 'float32' , imagVals ) } ; return complexInfo ; } export const complexConfig = { kernelName : Complex , backendName : 'cpu' , kernelFunc : complex as { } as KernelFunc } ;