How to assign a default value during indexing

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.

Would this work?

a = torch.tensor([[1, 2, 3], [1, 2, 3]])
c = torch.tensor([0, 2, 3])

a[a > (c.size(0) - 1)] = 0
c[a]

Yes, it does! Thanks