We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 07028d4 commit a78d262Copy full SHA for a78d262
pytensor/tensor/variable.py
@@ -349,6 +349,9 @@ def dimshuffle(self, *pattern):
349
if (len(pattern) == 1) and (isinstance(pattern[0], list | tuple | np.ndarray)):
350
pattern = pattern[0]
351
ds_op = pt.elemwise.DimShuffle(input_ndim=self.type.ndim, new_order=pattern)
352
+ if ds_op.new_order == tuple(range(self.type.ndim)):
353
+ # No-op
354
+ return self
355
return ds_op(self)
356
357
def flatten(self, ndim=1):
0 commit comments