Sure, maybe this can be best explained by an example:
In [1]: import torch                                                            

In [2]: a = torch.tensor([1, 2, 3])                                             

In [3]: b = a.clone().view(-1, 1)                                               

In [4]: b                                                                       
Out[4]: 
tensor([[1],
        [2],
        [3]])

In [5]: a == b                                                                  
Out[5]: 
tensor([[1, 0, 0],
        [0, 1, 0],
        [0, 0, 1]], dtype=torch.uint8)

I am not sure if this is an issue in your case, but adding a
assert op_class.size() == labels.view(*top_class.shape).size()

just to make sure doesn’t hurt