ClikaRT::ops::empty
function
empty()
Tensor empty(
ClikaRT::Span<const ScalarOrTensor> shape,
DataType dtype,
StreamOrDevice s = {},
StreamOrDevice pinned_for = {}
)
Uninitialized tensor of the given shape; the contents are whatever the allocator hands back; write every element before reading any.
Each shape extent is an int literal OR a 0-D integer Tensor (a tensor extent traces symbolically, never syncing to the host).
Parameters
shape: the extents, one entry per dim.dtype: element type.s: stream or device to allocate on. Default: the default device.pinned_for: optional PEER device this allocation is pinned FOR: page-locked host memory the peer can DMA directly, so transfers to/from that peer skip staging. When set,smust resolve to the CPU. Default: absent.
Throws
ClikaRT::Error: (INVALID_ARGUMENT) when an extent is negative, or whenpinned_foris set andsis not the CPU (code_name()carries the reason).
Returns: a new tensor of shape shape; contents uninitialized.
auto buf = ClikaRT::ops::empty({batch, dim}, ClikaRT::DataType::Float32);
Declared in ClikaRT/compute/ops.h, line 2210