namedtensor icon indicating copy to clipboard operation
namedtensor copied to clipboard

Addition isn't commutative (if dimensions are ordered)

Open zou3519 opened this issue 6 years ago • 1 comments

It feels a little weird, but I guess it is fine if the dimensions aren't supposed to be ordered

y = ntorch.randn(1, 1, 1, 1, names=['n', 'c', 'h', 'w'])
x = ntorch.randn(1, 1, names=['h', 'c'])

(x + y).shape
OrderedDict([('n', 1), ('w', 1), ('h', 1), ('c', 1)])

(y + x).shape
OrderedDict([('n', 1), ('c', 1), ('h', 1), ('w', 1)])

zou3519 avatar Feb 08 '19 23:02 zou3519

Yes, we've been debating this point. The current aggressive proposal is to change shape to not be an ordereddict at all, and remove the transpose function or have it return a non-named tensor.

srush avatar Feb 08 '19 23:02 srush