"dim" or "dims" are not present in the output tensor, then the
  corresponding names of those dimensions do not appear in
  "output.names".



x = torch.randn(1, 3, 3, 3, names=('N', 'C', 'H', 'W'))
x.squeeze('N').names
   ('C', 'H', 'W')
x = torch.randn(3, 3, 3, 3, names=('N', 'C', 'H', 'W'))
x.sum(['N', 'C']).names
   ('H', 'W')



# Reduction ops with keepdim=True don't actually remove dimensions.



x = torch.randn(3, 3, 3, 3, names=('N', 'C', 'H', 'W'))
x.sum(['N', 'C'], keepdim=True).names
   ('N', 'C', 'H', 'W')



Unifies names from inputs
All binary arithmetic ops follow this rule. Operations that broadcast
still broadcast positionally from the right to preserve compatibility
with unnamed tensors. To perform explicit broadcasting by names, use
"Tensor.align_as()".

Check names: All names must match positionally from the right. i.e.,
  in "tensor + other", "match(tensor.names[i], other.names[i])" must
