NDArray reshape in Fortran order?


#1

Hi there,

How to reshape a tensor in Fortran-like index order? There is no documentation about the default order, so I did an experiment and verified that NDArray is using C-like order. But what I need is Fortran-like order, can I do that in mxnet?

import mxnet.ndarray as nd
import numpy as np

A = np.arange(0, 6).reshape((2, 3))
B = nd.array(A)

print(np.allclose(A.reshape(3, 2, order='C'), B.reshape((3, 2)).asnumpy()))
print(np.allclose(A.reshape(3, 2, order='F'), B.reshape((3, 2)).asnumpy()))

Thanks


#2

I know print(B.T.reshape((2, 3)).T) works, but this is kind of stupid.


#3

mxnet only supports C-like order at the moment.