Skip to main content

ClikaRT::ops::empty_strided

function

empty_strided()

Tensor empty_strided(
    ClikaRT::Span<const std::int64_t> size,
    ClikaRT::Span<const std::int64_t> stride,
    DataType dtype,
    StreamOrDevice s = {}
)

Uninitialized tensor with caller-chosen sizes AND strides (element units).

The storage is sized to the strided footprint. Extents and strides are host integers (no tensor-valued entries on this factory).

Parameters

  • size: the extents, one per dim.
  • stride: element stride per dim (packed row-major = empty's layout).
  • dtype: element type.
  • s: stream or device to allocate on. Default: the default device.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when size and stride disagree in rank or a value is negative (code_name() carries the reason).

Returns: a new uninitialized tensor with exactly the given layout.

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