ModularM
Modular3y ago
seb

Populating values of tensor

Currently working on creating a one-hot encoding input tensor by initializing the tensor with zeros, and then setting individual cells of the 2D tensor to 1. However, trying to set the value with
tensor[i][j] = 1
is setting whole rows of the tensor at a time; how can I do this?
Was this page helpful?