Is there a way to implement 3-D scatter_/scatter_add_ in pytorch?
Specifically, I have a tensor X (shape (B, M, N)), an index tensor I of shape (B, C, D) giving indices into the X, and a values tensor V the same shape of as indices, (B, C, D). For indices (b, c, d) in I, I want to add V[b,c,d] to X[b,c,d].
Is there a way to implement this? The regular scatter_ function only indices using a single dim.
Hello,
I want to do the same thing. However, its in my training so I want to retain the gradient. I get a RuntimeError: a leaf Variable that requires grad is being used in an in-place operation. because X is my CNN outputs. So I have to use torch.scatter but I can’t wrap my head on how to do that ?