Assume that I have a list [(0,0),(1,0),(1,1)] and another list [4,5,6] and a matrix X with size is (3,2). I am trying to assign the list to the matrix like X[0,0] = 4, X[1,0] = 5 and X[1,1] = 6. But it seems like I have a problem of assigning a list to tensor
x = torch.zeros(3,2)
indices = [(0,0),(1,0),(1,1)]
value = [4,5,6]
x[indices] = values
Error:
TypeError Traceback (most recent call last)
<ipython-input-7-dec4e6a479a5> in <module>
4 indices = [(0, 0), (1, 0), (1, 1)]
5 values = [4, 5, 6]
----> 6 x[indices] = values
TypeError: can't assign a list to a torch.FloatTensor