Thanks, I have sth like :
if one_hot_tensor.size(0) > 1 : 
    return torch.argmax(one_hot_tensor)
else:
    return one_hot_tensor[0].int()

and this always returns a tensor and none of these proposed methods work!