Skip to main content

ClikaRT::ops::index_add

function

index_add()​

Tensor index_add(
    Tensor input,
    int64_t dim,
    Tensor indices,
    Tensor src
)

A copy of input with rows of src ACCUMULATED at indices along dim: out[.., indices[i], ..] += src[.., i, ..]; duplicate indices add up.

Parameters

  • input: the starting values.
  • dim: the addressed axis.
  • indices: 1-D integer positions (Int32/Int64).
  • src: the rows to add; its dim extent equals indices' length, every other extent matches input.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when the shapes disagree per the rule above or the index dtype is wrong (code_name() carries the reason).

Returns: a new tensor shaped like input.

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