I want to make a slice of a tensor with the same value.
import torch dist = torch.ones((10, 20), dtype=torch.int32) print(dist[[1, 2], [3, 4]])
It returns tensor([1, 1], dtype=torch.int32). But it should return tensor([[1, 1], [1, 1]], dtype=torch.int32). How do I make it to return this result?
tensor([1, 1], dtype=torch.int32)
tensor([[1, 1], [1, 1]], dtype=torch.int32)
2.1m questions
2.1m answers
60 comments
57.0k users