license import { ENGINE } from '../engine' ; import { Concat , ConcatAttrs , ConcatInputs } from '../kernel_names' ; import { NamedAttrMap } from '../kernel_registry' ; import { Tensor } from '../tensor' ; import { NamedTensorMap } from '../tensor_types' ; import { convertToTensorArray } from '../tensor_util_env' ; import { TensorLike } from '../types' ; import { assert } from '../util' ; import { clone } from './clone' ; import { op } from './operation' ; param tensors param axis doc function concat_ < T extends Tensor > ( tensors , axis = 0 ) { assert ( tensors . length >= 1 , ( ) => 'Pass at least one tensor to concat' ) ; const $tensors = convertToTensorArray ( tensors , 'tensors' , 'concat' , 'string_or_numeric' ) ; if ( $tensors [ 0 ] . dtype === 'complex64' ) { $tensors . forEach ( tensor => { if ( tensor . dtype !== 'complex64' ) { throw new Error ( `Cannot concatenate complex64 tensors with a tensor
          with dtype ${ tensor . dtype }. ` ) ; } } ) ; } if ( $tensors . length === 1 ) { return clone ( $tensors [ 0 ] ) ; } const inputs = $tensors ; const attr = { axis } ; return ENGINE . runKernel ( Concat , inputs as { } as NamedTensorMap , attr as { } as NamedAttrMap ) ; } export const concat = op ( { concat_ } ) ;