How to cut Tensor in Libtorch like python

tensor1 = tensor[0,:,:,0]
tensor2 = tensor[0,:,:,1]

Hi,

You can use the select method to get a single index on a given dimension and the narrow method to get a slice of a tensor on a given dimension

Thank you.
This is my way:
torch::Tensor score_text = score.slice(2,0,1,1).squeeze(2);