license import { Tensor3D } from '../tensor' ; import { inferShape } from '../tensor_util_env' ; import { TensorLike3D } from '../types' ; import { DataType } from '../types' ; import { assertNonNull } from '../util' ; import { makeTensor } from './tensor_ops_util' ; param values param shape param dtype doc export function tensor3d ( values , shape ? , dtype ? ) { assertNonNull ( values ) ; if ( shape != null && shape . length !== 3 ) { throw new Error ( 'tensor3d() requires shape to have three numbers' ) ; } const inferredShape = inferShape ( values , dtype ) ; if ( inferredShape . length !== 3 && inferredShape . length !== 1 ) { throw new Error ( 'tensor3d() requires values to be number[][][] or flat/TypedArray' ) ; } if ( inferredShape . length === 1 && shape == null ) { throw new Error ( 'tensor3d() requires shape to be provided when `values` ' + 'are a flat array' ) ; } return makeTensor ( values , shape , inferredShape , dtype ) as Tensor3D ; }