Transpose
=================

对输入数组按照指定维度顺序（perm）进行转置操作，并输出结果数组。

输入：
    - **in_data** - 输入数据地址。
    - **num_axes** - 数据维度数。
    - **output_shape** - 输出形状数组。
    - **perm** - 转置维度顺序数组。
    - **strides** - 输入数据每维步长。
    - **out_strides** - 输出数据每维步长。
    - **core_mask** - 核掩码（仅适用于共享存储版本）。

输出：
    - **out_data** - 转置结果地址。

支持平台：
    ``FT78NE``
    ``MT7004``

.. note::
    - FT78NE 支持fp, dp, int8, int16, int32, clx64, cplx128
    - MT7004 支持hp, fp, i16, i32, cplx64

**共享存储版本:**

.. c:function:: void fp_transpose_s(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const float* in_data, float* out_data, int core_mask)
.. c:function:: void hp_transpose_s(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const half* in_data, half* out_data, int core_mask)
.. c:function:: void dp_transpose_s(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const double* in_data, double* out_data, int core_mask)
.. c:function:: void i8_transpose_s(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const int8_t* in_data, int8_t* out_data, int core_mask)
.. c:function:: void i16_transpose_s(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const int16_t* in_data, int16_t* out_data, int core_mask)
.. c:function:: void i32_transpose_s(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const int* in_data, int* out_data, int core_mask)
.. c:function:: void c64_transpose_s(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const float* in_data, float* out_data, int core_mask)
.. c:function:: void c128_transpose_s(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const double* in_data, double* out_data, int core_mask)

**C调用示例：**

.. code-block:: c
    :linenos:
    :emphasize-lines: 14

    #include <stdio.h>
    #include <transpose.h>

    int main() {
        float *input = (float *)0xA0000000;      // 输入在DDR空间
        float *output = (float *)0xC0000000;
        int num_axes = 4;
        int output_shape[4] = {1, 3, 224, 224};
        int perm[4] = {0, 2, 3, 1};
        int strides[4] = {150528, 50176, 224, 1};
        int out_strides[4] = {150528, 50176, 224, 1};
        int core_mask = 0xff;

        fp_transpose_s(num_axes, output_shape, perm, strides, out_strides, input, output, core_mask);
        return 0;
    }


**私有存储版本:**

.. c:function:: void fp_transpose_p(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const float* in_data, float* out_data)
.. c:function:: void hp_transpose_p(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const half* in_data, half* out_data)
.. c:function:: void dp_transpose_p(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const double* in_data, double* out_data)
.. c:function:: void i8_transpose_p(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const int8_t* in_data, int8_t* out_data)
.. c:function:: void i16_transpose_p(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const int16_t* in_data, int16_t* out_data)
.. c:function:: void i32_transpose_p(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const int* in_data, int* out_data)
.. c:function:: void c64_transpose_p(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const float* in_data, float* out_data)
.. c:function:: void c128_transpose_p(int num_axes, const int* output_shape, int* perm, int* strides, int* out_strides, const double* in_data, double* out_data)

**C调用示例：**

.. code-block:: c
    :linenos:
    :emphasize-lines: 13

    #include <stdio.h>
    #include <transpose.h>

    int main() {
        float *input = (float *)0x10810000;      // 输入在L2空间
        float *output = (float *)0x10820000;
        int num_axes = 4;
        int output_shape[4] = {1, 3, 224, 224};
        int perm[4] = {0, 2, 3, 1};
        int strides[4] = {150528, 50176, 224, 1};
        int out_strides[4] = {150528, 50176, 224, 1};

        fp_transpose_p(num_axes, output_shape, perm, strides, out_strides, input, output);
        return 0;
    }
