MCPcopy
hub / github.com/tensorflow/tfjs / zeros

Function zeros

tfjs-core/src/ops/zeros.ts:38–48  ·  view source on GitHub ↗
(
    shape: ShapeMap[R], dtype: DataType = 'float32')

Source from the content-addressed store, hash-verified

36 * @doc {heading: 'Tensors', subheading: 'Creation'}
37 */
38export 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}

Callers 15

applyMethod · 0.90
models_test.tsFile · 0.90
model_save_test.tsFile · 0.90
applyMethod · 0.90
variables_test.tsFile · 0.90
topology_test.tsFile · 0.90
training_test.tsFile · 0.90
createDenseModelAndDataFunction · 0.90

Calls 5

makeZerosTypedArrayFunction · 0.90
sizeFromShapeFunction · 0.90
makeTensorMethod · 0.65
complexFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…