Say that I have a tensor as follows:
a = torch.tensor([[1, 2, 3], [1, 2, 3]])
My problem is, what if I only have a look-up table of:
c = torch.tensor([0, 2, 3])
In which, for every out-of-index, I would like it to be assigned to index 0, such as c[a] will return
tensor([[2, 3, 0], [2, 3, 0]])
Does anyone know a function to do this?
Thanks for your help.