Skip to main content

ClikaRT::ops::one_hot

function

one_hot()

Tensor one_hot(Tensor indices, int64_t num_classes)

Expands an integer index tensor into a trailing one-hot dimension.

Parameters

  • indices: integer indices, any shape; each value must lie in [0, num_classes).
  • num_classes: the one-hot width.

Throws

  • ClikaRT::Error: when indices is not an integer dtype or a value is out of range (code_name() carries the reason).

Returns: indices.shape ++ [num_classes], Int64.

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