Compound Assignment Reference Semantics and Gradient Calculations

This recently came up in another post: Intended behavior of vector[array_idx] += vector?

The short answer is there is no reference semantics. In cases where C++ would, we end up creating a hard copy to avoid it.

The code is generated that way in the scalar case because of how it is required to be when non-scalars are involved, and it is easier to have it be uniformly handled on our end.

1 Like