# mars.tensor.fft.irfftn#

mars.tensor.fft.irfftn(a, s=None, axes=None, norm=None)[source]#

Compute the inverse of the N-dimensional FFT of real input.

This function computes the inverse of the N-dimensional discrete Fourier Transform for real input over any number of axes in an M-dimensional tensor by means of the Fast Fourier Transform (FFT). In other words, `irfftn(rfftn(a), a.shape) == a` to within numerical accuracy. (The `a.shape` is necessary like `len(a)` is for irfft, and for the same reason.)

The input should be ordered in the same way as is returned by rfftn, i.e. as for irfft for the final transformation axis, and as for ifftn along all the other axes.

Parameters
• a (array_like) – Input tensor.

• s (sequence of ints, optional) – Shape (length of each transformed axis) of the output (`s` refers to axis 0, `s` to axis 1, etc.). s is also the number of input points used along this axis, except for the last axis, where `s[-1]//2+1` points of the input are used. Along any axis, if the shape indicated by s is smaller than that of the input, the input is cropped. If it is larger, the input is padded with zeros. If s is not given, the shape of the input along the axes specified by axes is used.

• axes (sequence of ints, optional) – Axes over which to compute the inverse FFT. If not given, the last len(s) axes are used, or all axes if s is also not specified. Repeated indices in axes means that the inverse transform over that axis is performed multiple times.

• norm ({None, "ortho"}, optional) – Normalization mode (see mt.fft). Default is None.

Returns

out – The truncated or zero-padded input, transformed along the axes indicated by axes, or by a combination of s or a, as explained in the parameters section above. The length of each transformed axis is as given by the corresponding element of s, or the length of the input in every axis except for the last one if s is not given. In the final transformed axis the length of the output when s is not given is `2*(m-1)` where `m` is the length of the final transformed axis of the input. To get an odd number of output points in the final axis, s must be specified.

Return type

Tensor

Raises
• ValueError – If s and axes have different length.

• IndexError – If an element of axes is larger than than the number of axes of a.

`rfftn`

The forward n-dimensional FFT of real input, of which ifftn is the inverse.

`fft`

The one-dimensional FFT, with definitions and conventions used.

`irfft`

The inverse of the one-dimensional FFT of real input.

`irfft2`

The inverse of the two-dimensional FFT of real input.

Notes

See fft for definitions and conventions used.

See rfft for definitions and conventions used for real input.

Examples

```>>> import mars.tensor as mt
```
```>>> a = mt.zeros((3, 2, 2))
>>> a[0, 0, 0] = 3 * 2 * 2
>>> mt.fft.irfftn(a).execute()
array([[[ 1.,  1.],
[ 1.,  1.]],
[[ 1.,  1.],
[ 1.,  1.]],
[[ 1.,  1.],
[ 1.,  1.]]])
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.80012286,"math_prob":0.99150634,"size":2617,"snap":"2022-40-2023-06","text_gpt3_token_len":688,"char_repetition_ratio":0.13777268,"word_repetition_ratio":0.034408603,"special_character_ratio":0.2732136,"punctuation_ratio":0.16464472,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9950558,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-10-02T18:38:33Z\",\"WARC-Record-ID\":\"<urn:uuid:e6c67db5-0d1c-48f6-8527-aa41bb928d39>\",\"Content-Length\":\"193192\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:836d4f4b-ee31-4cff-8ffd-3992f34b9ae3>\",\"WARC-Concurrent-To\":\"<urn:uuid:7ea6f247-5e79-4118-b544-fafaa194a9d0>\",\"WARC-IP-Address\":\"104.17.33.82\",\"WARC-Target-URI\":\"https://docs.pymars.org/en/latest/reference/tensor/generated/mars.tensor.fft.irfftn.html\",\"WARC-Payload-Digest\":\"sha1:7YHZ7I6UEYASIKPVIQFKO2UCNUOX6DM4\",\"WARC-Block-Digest\":\"sha1:QH4Q6KGDWSWL7Z45RUUNNOYR5H2OFYBU\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030337339.70_warc_CC-MAIN-20221002181356-20221002211356-00296.warc.gz\"}"}