Notice that in PyTorch version, a tensor and index operation could be written like below
tensor_test = torch.randn(1, 27)
tensor_test[:, 5:]
In C++ libtorch version, i noticed that i have to set the dim=-1
in slice function so that i could get the right answer. But i don’t understand what dim=-1
means.
tensor_test = torch::randn({1, 27})
tensor_test.slice(-1, 5, tensor_test.sizes()[1])