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.]])
```





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/index-put-operator-in-relay/9094/1) to 
respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/0b85279d00fbd8a342b3048290ec156a3058d31dae593f0d97f84ad4c40551cb).

Reply via email to