Skip to main content

ClikaRT::ops::zeros

function

zeros()

Tensor zeros(
    ClikaRT::Span<const ScalarOrTensor> shape,
    DataType dtype,
    StreamOrDevice s = {},
    StreamOrDevice pinned_for = {}
)

A new tensor of the given shape with every element set to zero.

Same shape-span and pinned_for contract as empty (extents are literals or 0-D integer Tensors).

Throws

  • ClikaRT::Error: when the input's dtype is not served for this operation (the machine-readable reason rides code_name()).

Returns: a new zero-filled tensor.

auto acc = ClikaRT::ops::zeros({b, d}, ClikaRT::DataType::Float32);

Declared in ClikaRT/compute/ops.h, line 2378