license import { ENGINE } from '../engine' ; import { Complex , ComplexInputs } from '../kernel_names' ; import { Tensor } from '../tensor' ; import { NamedTensorMap } from '../tensor_types' ; import { convertToTensor } from '../tensor_util_env' ; import { TensorLike } from '../types' ; import * as util from '../util' ; import { op } from './operation' ; doc function complex_ < T extends Tensor > ( real , imag ) { const $real = convertToTensor ( real , 'real' , 'complex' ) ; const $imag = convertToTensor ( imag , 'imag' , 'complex' ) ; util . assertShapesMatch ( $real . shape , $imag . shape , `real and imag shapes, ${ $real . shape } and ${ $imag . shape }, ` + `must match in call to tf.complex().` ) ; const inputs = { real : $real , imag : $imag } ; return ENGINE . runKernel ( Complex , inputs as { } as NamedTensorMap ) ; } export const complex = op ( { complex_ } ) ;