How to get last element from the prediction?

I am new to PyTorch. I have a variable pred which has a list of a tensor.

output: [tensor([[176.64380, 193.86154, 273.84702, 306.30405,   0.83492,   2.00000]])]

So I wanted to access the last element which is the class. I did that by first converting the list into a tensor.

x = torch.stack(pred)
output: tensor([[[176.64380, 193.86154, 273.84702, 306.30405,   0.83492,   2.00000]]])

Now, how do I access the last element or is there any better/efficient way of doing this??

Thank you for the help!

You can access the last element (2.0) via x[0, 0, -1].