I want to overwrite the values of a certain column of a 3-dimensional tensor(batch size, sequence length, number of classes) with a 2-dimensional tensor (batch size, sequence length). I have tried the following value assignment on numpy while debugging and worked perfectly fine but not sure how to do the same on tensor.
Numpy Solution:
Tensor A shape [50,4,4]
Tensor B shape [50,4]
* A[:,:,0]=b[:,:]
Tensor A shape is [50,4,4]
Example:
A[1]:
[[0.2,0.6,0.1,0.02],
[0.3,0.4,0.5,0.12],
[0.2,0.46,0.31,0.02],
[0.2,0.1,0.2,0.03]]
B[1]:
[0,1,1,0]
A*[1]:
[[0,0.6,0.1,0.02],
[1,0.4,0.5,0.12],
[1,0.46,0.31,0.02],
[0,0.1,0.2,0.03]]
I know that item assignment is not supported on tensors but was wondering if there is a way without losing the data of ref tensor.