Skip to main content

ClikaRT::ops::index_add

function

index_add()

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

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

Parameters

  • x: 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 x.

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 x.

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