Thanks, @googlebot Alex.  I actually need to do this task parallelly. Is there a PyTorch utility that can help in running such a function parallelly?
E.g. methods like torch.sum() and torch.mean() allow us to specify a dimension over which we can reduce. I am looking for a similar way to hash the elements of a multi-dimensional input.