Traverse torch::Tensor by batch

Hello, I would like to know how I can traverse a tensor with dims{5,3,36,36} by batch. I would like to traverse each batch and return it into another tensor to do an operation using the c++ torch front end. I am using v1.3.0 so cannot use Slice in the new v1.5.0 libs. How can I do this ?


You can use .select(dim, idx). Where you want to use dim=0 and idx being the batch index.