What operator in Relay can be used to set multiple values to a given tensor?
Lets say I have 3x3 tensor “A” and I need to set
A[0,0] = 2.0
A[1,1] = 4.0
A[2,1] = 7.0
A[2,2] = 9.0
PyTorch code:
A = torch.zeros(3,3)
hs = torch.tensor([0, 1, 2, 2])
ws = torch.tensor([0, 1, 1, 2])
vs = torch.tensor([2.0, 4.0, 7.0, 9.0])
A.index_put(indices=[hs, ws], values = vs)
tensor([[2., 0., 0.],
[0., 4., 0.],
[0., 7., 9.]])