FT_DSP.gitlink.net/master/html/_sources/functionlib/dsplib/squeeze.rst.txt

42 lines
1.4 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Squeeze
=================
返回删除指定axis中大小为1的维度后的Tensor。由于该算子仅改变张量形状因此其DSP算子的作用是将数据从输入张量完整拷贝到输出张量。
输入:
- **src** - 输入地址
- **total_copy_size** - 计算得到的总共需拷贝的数据量,单位为字节。
- **core_mask** - 核掩码。
输出:
- **dst** - 输出地址。
支持平台:
``FT78NE``
``MT7004``
.. note::
- FT78NE 支持int8, int16, int32, fp32, fp64, cplx64, cplx128
- MT7004 支持fp16, fp32, int16, int32, cplx64
**共享/私有存储版本:**
.. c:function:: void anytype_squeeze_anycore(void* src, void* dst, int total_copy_size, int core_mask)
各种数据类型、私有及共享空间版本均使用该函数。
**C调用示例**
.. code-block:: c
:linenos:
:emphasize-lines: 8
void main(){
int core_mask = 0b1111; // 测试单核时核掩码设置为0b0001即可
int core_num = GetCoreNum(core_mask);
float* src = (float*)0x88000000; // 测试私有空间时地址设置在私有空间内即可
float* dst = (float*)0x98000000;
int shape[3] = {1, 10, 10};
int total_copy_size = shape[0] * shape[1] * shape[2] * sizeof(float);
anytype_squeeze_anycore(src, dst, total_copy_size, core_mask);
}