Get standard deviation of multiple tensors

Hi, i want to get the standard deviations of multiple image tensors [10,1024,1024]. for each element (like from position [0,0,0] to [9,0,0] for each position in the tensors

Currently i´m using uncertainty_prediction = torch.std(total_prediction,dim=0) however this returns a tensor [1024,1024] with 0.5 everywhere. This is not correct, as there should be different std deviations at each element of the resulting tensors.

I´ve looked on google, and since I´m rather new to pytorch i probably missed the answere, but is there a build in solution to this? or am i just using the torch.std() wrong? I really want to avoid iterating over all the tensors.

Thanks a lot
Greetings

Right, in this case it seems you actually want to reduce across the second and third dimensions (I think a good way to think about this is which dimensions would you be averaging across to calculate the corresponding mean?). Does uncertainty_prediction = torch.std(total_prediction,dim=(1,2)) work?