Skip to main content

ClikaRT::ops::contiguous

function

contiguous()

Tensor contiguous(Tensor x, bool force_copy = false)

Packs the tensor into row-major contiguous storage.

A no-op passthrough (no copy, same storage) when the input is already contiguous and force_copy is false. Kernels stride natively; call this only when YOUR host-side consumption needs dense memory, never "to be safe" before an op.

Parameters

  • x: the input tensor (any strides).
  • force_copy: always materialize. Default false.

Throws

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

Returns: a contiguous tensor with x's shape, dtype, and values.

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