'How to perform numpy swapaxes on eigen tensor?

I have to convert python code into the Eigen library.

Numpy -

    image  # shape of dimZ,dimY,dimX
    image = np.swapaxes(image, 0, 2)
    image = np.swapaxes(image, 0, 1)
    image = np.flip(image, 0)

Same in Eigen tensor

Eigen::Tensor<float, 3, Eigen::RowMajor> image(dimZ, dimY, dimX);

How to do swapaxes and flip in Eigen tensor? I didn't find any example in their documentation.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source