Ah OK, in that case I misunderstood the use case.
Yes, you could permute the inputs and reshape it back.
However, from the TF docs it’s unclear to me how the 5 dimensions are handled, so could you explain the underlying operations or at least compare the outputs before continuing the porting of the code.