(
shape: ShapeMap[R], dtype: DataType = 'float32')
| 36 | * @doc {heading: 'Tensors', subheading: 'Creation'} |
| 37 | */ |
| 38 | export function zeros<R extends Rank>( |
| 39 | shape: ShapeMap[R], dtype: DataType = 'float32'): Tensor<R> { |
| 40 | assertNonNegativeIntegerDimensions(shape); |
| 41 | if (dtype === 'complex64') { |
| 42 | const real = zeros(shape, 'float32'); |
| 43 | const imag = zeros(shape, 'float32'); |
| 44 | return complex(real, imag); |
| 45 | } |
| 46 | const values = makeZerosTypedArray(sizeFromShape(shape), dtype); |
| 47 | return ENGINE.makeTensor(values, shape, dtype) as Tensor<R>; |
| 48 | } |
no test coverage detected
searching dependent graphs…