Skip to main content

ClikaRT::ops::empty_like

function

empty_like()

Tensor empty_like(Tensor reference, StreamOrDevice s = {})

Uninitialized tensor with reference's shape and dtype.

Parameters

  • reference: supplies shape and dtype; its data is never read.
  • s: stream or device; absent = the REFERENCE's own device (an explicit stream/device wins). Default: absent.

Throws

  • ClikaRT::Error: when the allocation cannot be served (code_name() carries the reason).

Returns: a new uninitialized tensor shaped like reference, on its device.

auto scratch = ClikaRT::ops::empty_like(x); // same shape/dtype/device as x

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