How to remove multiple elements from a tensor by index?

Hi all,

Is there anyway I can remove multiple elements from a tensor according to index?

For example, I have a tensor with 10000 elements, and I have the indexes of 1000 elements that I want to remove. In numpy I can do this simply by np.delete, is there any similar function I can use in torch?
Thanks for any help!!

Best

Is it a way to use the index to select?

q=torch.randn(5)
retain_ind=[0,2]
q=q[retain_ind]

Then we remove the [1,3,4] elements.