forked from FT_DSP/FT_DSP.gitlink.net
226 lines
14 KiB
HTML
226 lines
14 KiB
HTML
|
||
|
||
<!DOCTYPE html>
|
||
<html class="writer-html5" lang="zh-CN" data-content_root="../../">
|
||
<head>
|
||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>FFTImag — MindSpore Signal+ 使用手册 alpha 文档</title>
|
||
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=03e43079" />
|
||
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=e59714d7" />
|
||
<link rel="stylesheet" type="text/css" href="../../_static/table.css?v=72b86d3e" />
|
||
|
||
|
||
<script src="../../_static/jquery.js?v=5d32c60e"></script>
|
||
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
||
<script src="../../_static/documentation_options.js?v=406e4f49"></script>
|
||
<script src="../../_static/doctools.js?v=9bcbadda"></script>
|
||
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
<script src="../../_static/translations.js?v=beaddf03"></script>
|
||
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||
<script src="../../_static/table.js?v=99ed15ba"></script>
|
||
<script src="../../_static/js/theme.js"></script>
|
||
<link rel="index" title="索引" href="../../genindex.html" />
|
||
<link rel="search" title="搜索" href="../../search.html" />
|
||
<link rel="next" title="BatchNorm" href="batchnorm.html" />
|
||
<link rel="prev" title="FFTReal" href="fftreal.html" />
|
||
</head>
|
||
|
||
<body class="wy-body-for-nav">
|
||
<div class="wy-grid-for-nav">
|
||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||
<div class="wy-side-scroll">
|
||
<div class="wy-side-nav-search" >
|
||
|
||
|
||
|
||
<a href="../../index.html" class="icon icon-home">
|
||
MindSpore Signal+ 使用手册
|
||
</a>
|
||
<div role="search">
|
||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||
<input type="text" name="q" placeholder="搜索文档" aria-label="搜索文档" />
|
||
<input type="hidden" name="check_keywords" value="yes" />
|
||
<input type="hidden" name="area" value="default" />
|
||
</form>
|
||
</div>
|
||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="导航菜单">
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="../../quickstart/index.html">快速入门</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../../appdevelop/index.html">应用开发示例</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../index.html">算子库支持</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../../refdoc/index.html">参考资料</a></li>
|
||
</ul>
|
||
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="移动版导航菜单" >
|
||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||
<a href="../../index.html">MindSpore Signal+ 使用手册</a>
|
||
</nav>
|
||
|
||
<div class="wy-nav-content">
|
||
<div class="rst-content">
|
||
<div role="navigation" aria-label="页面导航">
|
||
<ul class="wy-breadcrumbs">
|
||
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
|
||
<li class="breadcrumb-item"><a href="../index.html">算子库支持</a></li>
|
||
<li class="breadcrumb-item"><a href="dsplib_index.html">DSP Library C API Reference</a></li>
|
||
<li class="breadcrumb-item active">FFTImag</li>
|
||
<li class="wy-breadcrumbs-aside">
|
||
<a href="../../_sources/functionlib/dsplib/fftimag.rst.txt" rel="nofollow"> 查看页面源码</a>
|
||
</li>
|
||
</ul>
|
||
<hr/>
|
||
</div>
|
||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||
<div itemprop="articleBody">
|
||
|
||
<section id="fftimag">
|
||
<h1>FFTImag<a class="headerlink" href="#fftimag" title="Link to this heading"></a></h1>
|
||
<p>对输入复数序列虚数部分执行一维快速傅里叶变换(FFT)或逆变换(IFFT)。
|
||
内部基于分治 FFT 算法,
|
||
并使用预计算旋转因子(twiddle factor)以提升性能。
|
||
傅里叶变换,可以对参数进行调整,以实现FFT/IFFT/RFFT/IRFFT。</p>
|
||
<p>数学定义如下:</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[X(k) = \sum_{n=0}^{N-1} x(n)\,e^{-j 2\pi kn / N} \quad (\text{Forward FFT})\]</div>
|
||
<div class="math notranslate nohighlight">
|
||
\[x(n) = \sum_{k=0}^{N-1} X(k)\,e^{j 2\pi kn / N} \quad (\text{Inverse FFT})\]</div>
|
||
<p>其中 <span class="math notranslate nohighlight">\(N\)</span> 为 FFT 点数。</p>
|
||
<dl class="simple">
|
||
<dt>输入:</dt><dd><ul class="simple">
|
||
<li><p><strong>input</strong> - 输入复数数据地址。</p></li>
|
||
<li><p><strong>fft_size</strong> - FFT 点数。</p></li>
|
||
<li><dl class="simple">
|
||
<dt><strong>dir</strong> - 变换方向:</dt><dd><ul>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">FFT_FORWARD</span></code>:正向 FFT</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">FFT_INVERSE</span></code>:反向 FFT</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
<li><p><strong>scratch_ptr</strong> - 临时缓冲区地址,用于存放旋转因子及中间计算结果。</p></li>
|
||
<li><p><strong>twiddle</strong> - 旋转因子地址(仅共享存储版本使用)。</p></li>
|
||
<li><p><strong>fft_size1</strong> - 第一阶段 FFT 点数(仅共享存储版本使用)。</p></li>
|
||
<li><p><strong>fft_size2</strong> - 第二阶段 FFT 点数(仅共享存储版本使用)。</p></li>
|
||
<li><p><strong>core_mask</strong> - 核掩码(仅共享存储版本需要)。</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt>输出:</dt><dd><ul class="simple">
|
||
<li><p><strong>output</strong> - 输出复数序列地址。</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<p>内部核心计算公式如下:
|
||
对于FFT,它计算以下表达式:</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[X[\omega_1, \dots, \omega_d] =
|
||
\sum_{n_1=0}^{N_1-1} \dots \sum_{n_d=0}^{N_d-1} x[n_1, \dots, n_d]
|
||
e^{-j\ 2 \pi \sum_{i=0}^d \frac{\omega_i n_i}{N_i}},\]</div>
|
||
<p>其中, <span class="math notranslate nohighlight">\(d\)</span> = <cite>signal_ndim</cite> 是信号的维度,<span class="math notranslate nohighlight">\(N_i\)</span> 则是信号第 <span class="math notranslate nohighlight">\(i\)</span> 个维度的大小。</p>
|
||
<p>对于IFFT,它计算以下表达式:</p>
|
||
<div class="math notranslate nohighlight">
|
||
\[X[\omega_1, \dots, \omega_d] =
|
||
\frac{1}{\prod_{i=1}^d N_i} \sum_{n_1=0}^{N_1-1} \dots \sum_{n_d=0}^{N_d-1} x[n_1, \dots, n_d]
|
||
e^{\ j\ 2 \pi \sum_{i=0}^d \frac{\omega_i n_i}{N_i}},\]</div>
|
||
<p>其中, <span class="math notranslate nohighlight">\(d\)</span> = <cite>signal_ndim</cite> 是信号的维度,<span class="math notranslate nohighlight">\(N_i\)</span> 则是信号第 <span class="math notranslate nohighlight">\(i\)</span> 维的大小。</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">备注</p>
|
||
<ul class="simple">
|
||
<li><p>FFT/IFFT要求complex64或complex128类型的输入,返回complex64或complex128类型的输出。</p></li>
|
||
<li><p>RFFT要求bool, uint8, int8, int16, int32, int64, float32或float64类型的输入,
|
||
返回complex64或complex128类型的输出。</p></li>
|
||
<li><p>IRFFT要求complex64或complex128类型的输入,返回float32或float64类型的输出。</p></li>
|
||
<li><p>共享存储版本/私有存储版本支持函数及调用见RFFT。</p></li>
|
||
</ul>
|
||
</div>
|
||
<dl class="simple">
|
||
<dt>参数:</dt><dd><ul class="simple">
|
||
<li><p><strong>signal_ndim</strong> (int) - 表示每个信号中的维数,控制着傅里叶变换的维数,其值只能为1、2或3。</p></li>
|
||
<li><p><strong>inverse</strong> (bool) - 表示该操作是否为逆变换,用以选择FFT 和 RFFT 或 IFFT 和 IRFFT。</p>
|
||
<ul>
|
||
<li><p>如果为 <code class="docutils literal notranslate"><span class="pre">True</span></code> ,则为IFFT 和 IRFFT。</p></li>
|
||
<li><p>如果为 <code class="docutils literal notranslate"><span class="pre">False</span></code> ,FFT 和 RFFT。</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>real</strong> (bool) - 表示该操作是否为实变换,与 <cite>inverse</cite> 共同决定具体的变换模式:</p>
|
||
<ul>
|
||
<li><p><cite>inverse</cite> 为 <code class="docutils literal notranslate"><span class="pre">False</span></code> , <cite>real</cite> 为 <code class="docutils literal notranslate"><span class="pre">False</span></code> :对应FFT模式。</p></li>
|
||
<li><p><cite>inverse</cite> 为 <code class="docutils literal notranslate"><span class="pre">True</span></code> , <cite>real</cite> 为 <code class="docutils literal notranslate"><span class="pre">False</span></code> :对应IFFT模式。</p></li>
|
||
<li><p><cite>inverse</cite> 为 <code class="docutils literal notranslate"><span class="pre">False</span></code> , <cite>real</cite> 为 <code class="docutils literal notranslate"><span class="pre">True</span></code> :对应RFFT模式。</p></li>
|
||
<li><p><cite>inverse</cite> 为 <code class="docutils literal notranslate"><span class="pre">True</span></code> , <cite>real</cite> 为 <code class="docutils literal notranslate"><span class="pre">True</span></code> :对应IRFFT模式。</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>norm</strong> (str,可选) - 表示该操作的规范化方式,可选值:[ <code class="docutils literal notranslate"><span class="pre">"backward"</span></code> , <code class="docutils literal notranslate"><span class="pre">"forward"</span></code> , <code class="docutils literal notranslate"><span class="pre">"ortho"</span></code> ]。默认值: <code class="docutils literal notranslate"><span class="pre">"backward"</span></code> 。</p>
|
||
<ul>
|
||
<li><p>"backward",正向变换不缩放,逆变换按 <span class="math notranslate nohighlight">\(1/n\)</span> 缩放,其中 <cite>n</cite> 表示输入 <cite>x</cite> 的元素数量。。</p></li>
|
||
<li><p>"ortho",正向变换与逆变换均按 <span class="math notranslate nohighlight">\(1/\sqrt n\)</span> 缩放。</p></li>
|
||
<li><p>"forward",正向变换按 <span class="math notranslate nohighlight">\(1/n\)</span> 缩放,逆变换不缩放。</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>onesided</strong> (bool,可选) - 控制输入是否减半以避免冗余。默认值: <code class="docutils literal notranslate"><span class="pre">True</span></code> 。</p></li>
|
||
<li><p><strong>signal_sizes</strong> (tuple,可选) - 原始信号的大小(RFFT变换之前的信号,不包含batch这一维),只有在IRFFT模式下和设置 <cite>onesided</cite> 为True时需要该参数,需要满足
|
||
以下条件。默认值: <code class="docutils literal notranslate"><span class="pre">()</span></code> 。</p>
|
||
<ul>
|
||
<li><p><cite>signal_sizes</cite> 的长度等于IRFFT的 <cite>signal_ndim</cite> : <span class="math notranslate nohighlight">\(len(signal\_sizes)=signal\_ndim\)</span> 。</p></li>
|
||
<li><p><cite>signal_sizes</cite> 的最后一个维度除以2等于IRFFT输入的最后一个维度: <span class="math notranslate nohighlight">\(signal\_size[-1]/2+1=x.shape[-1]\)</span> 。</p></li>
|
||
<li><p>除了最后一个维度外, <cite>signal_sizes</cite> 的维度与输入shape完全相同: <span class="math notranslate nohighlight">\(signal\_sizes[:-1]=x.shape[:-1]\)</span> 。</p></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</dd>
|
||
<dt>异常:</dt><dd><ul class="simple">
|
||
<li><p><strong>TypeError</strong> - 如果FFT/IFFT/IRFF的输入类型不是以下类型之一:complex64、complex128。</p></li>
|
||
<li><p><strong>TypeError</strong> - 如果输入的类型不是Tensor。</p></li>
|
||
<li><p><strong>ValueError</strong> - 如果输入 <cite>x</cite> 的维度小于 <cite>signal_ndim</cite> 。</p></li>
|
||
<li><p><strong>ValueError</strong> - 如果 <cite>signal_ndim</cite> 大于3或小于1。</p></li>
|
||
<li><p><strong>ValueError</strong> - 如果 <cite>norm</cite> 取值不是"backward"、"forward"或"ortho"。</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt>支持平台:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">FT78NE</span></code>
|
||
<code class="docutils literal notranslate"><span class="pre">MT7004</span></code></p>
|
||
</dd>
|
||
<dt>类型支持:</dt><dd><ul class="simple">
|
||
<li><p>FT78NE:<code class="docutils literal notranslate"><span class="pre">cplx64</span></code>、<code class="docutils literal notranslate"><span class="pre">cplx128</span></code></p></li>
|
||
<li><p>MT7004:<code class="docutils literal notranslate"><span class="pre">cplx64</span></code></p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</section>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="页脚">
|
||
<a href="fftreal.html" class="btn btn-neutral float-left" title="FFTReal" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> 上一页</a>
|
||
<a href="batchnorm.html" class="btn btn-neutral float-right" title="BatchNorm" accesskey="n" rel="next">下一页 <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||
</div>
|
||
|
||
<hr/>
|
||
|
||
<div role="contentinfo">
|
||
<p>© 版权所有 2025 - 2026, NUDT-674。</p>
|
||
</div>
|
||
|
||
利用 <a href="https://www.sphinx-doc.org/">Sphinx</a> 构建,使用的
|
||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">主题</a>
|
||
由 <a href="https://readthedocs.org">Read the Docs</a> 开发.
|
||
|
||
|
||
</footer>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
<script>
|
||
jQuery(function () {
|
||
SphinxRtdTheme.Navigation.enable(true);
|
||
});
|
||
</script>
|
||
|
||
</body>
|
||
</html> |