license import { ENGINE } from '../engine' ; import { ExpandDims , ExpandDimsAttrs , ExpandDimsInputs } from '../kernel_names' ; import { NamedAttrMap } from '../kernel_registry' ; 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' ; param x param axis doc function expandDims_ < T extends Tensor > ( x , axis = 0 ) { const $x = convertToTensor ( x , 'x' , 'expandDims' , 'string_or_numeric' ) ; util . assert ( axis <= $x . rank , ( ) => 'Axis must be <= rank of the tensor' ) ; const inputs = { input : $x } ; const attrs = { dim : axis } ; return ENGINE . runKernel ( ExpandDims , inputs as { } as NamedTensorMap , attrs as { } as NamedAttrMap ) ; } export const expandDims = op ( { expandDims_ } ) ;