Skip to main content

ClikaRT::ops::full

function

full()

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

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

Each shape extent is an int literal or a 0-D integer Tensor (traces symbolically). fill_value is a scalar-literal slot: an integer keeps its integer-ness across the boundary and stays exact past 2^53; a tensor arm is rejected. See Tensor::full for the same contract.

Parameters

  • shape: extents, one per dim.
  • fill_value: the value, cast to dtype.
  • dtype: element type.
  • s: stream or device. Default: the default device.
  • pinned_for: peer-pinned host allocation (see empty). Default: absent.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when fill_value carries a tensor or an extent is negative (code_name() carries the reason).

Returns: a new filled tensor.

auto neg_inf = ClikaRT::ops::full({b, s}, -1e9, ClikaRT::DataType::Float32);

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