|
6031 | 6031 | Complex-to-complex Discrete Fourier Transform |
6032 | 6032 |
|
6033 | 6033 | This method computes the complex-to-complex discrete Fourier transform. |
6034 | | -Ignoring the batch dimension, it computes the following expression: |
| 6034 | +Ignoring the batch dimensions, it computes the following expression: |
6035 | 6035 |
|
6036 | 6036 | .. math:: |
6037 | 6037 | X[\omega_1, \dots, \omega_d] = |
|
6044 | 6044 | This method supports 1D, 2D and 3D complex-to-complex transforms, indicated |
6045 | 6045 | by :attr:`signal_ndim`. :attr:`input` must be a tensor with last dimension |
6046 | 6046 | of size 2, representing the real and imaginary components of complex |
6047 | | -numbers, and should have ``signal_ndim + 1`` dimensions or ``signal_ndim + 2`` |
6048 | | -dimensions with batched data. If :attr:`normalized` is set to ``True``, this |
6049 | | -normalizes the result by dividing it with :math:`\sqrt{\prod_{i=1}^K N_i}` so |
6050 | | -that the operator is unitary. |
| 6047 | +numbers, and should have at least ``signal_ndim + 1`` dimensions with optionally |
| 6048 | +arbitrary number of leading batch dimensions. If :attr:`normalized` is set to |
| 6049 | +``True``, this normalizes the result by dividing it with |
| 6050 | +:math:`\sqrt{\prod_{i=1}^K N_i}` so that the operator is unitary. |
6051 | 6051 |
|
6052 | 6052 | Returns the real and the imaginary parts together as one tensor of the same |
6053 | 6053 | shape of :attr:`input`. |
|
6059 | 6059 | :func:`torch.backends.mkl.is_available` to check if MKL is installed. |
6060 | 6060 |
|
6061 | 6061 | Arguments: |
6062 | | - input (Tensor): the input tensor |
| 6062 | + input (Tensor): the input tensor of at least :attr:`signal_ndim` ``+ 1`` |
| 6063 | + dimensions |
6063 | 6064 | signal_ndim (int): the number of dimensions in each signal. |
6064 | 6065 | :attr:`signal_ndim` can only be 1, 2 or 3 |
6065 | 6066 | normalized (bool, optional): controls whether to return normalized results. |
|
6119 | 6120 | 0.2740 1.3332 |
6120 | 6121 | [torch.FloatTensor of size (4,3,2)] |
6121 | 6122 |
|
| 6123 | + >>> # arbitrary number of batch dimensions, 2D FFT |
| 6124 | + >>> x = torch.randn(3, 3, 5, 5, 2) |
| 6125 | + >>> y = torch.fft(x, 2) |
| 6126 | + >>> y.shape |
| 6127 | + torch.Size([3, 3, 5, 5, 2]) |
| 6128 | +
|
6122 | 6129 | """) |
6123 | 6130 |
|
6124 | 6131 | add_docstr(torch.ifft, |
|
6128 | 6135 | Complex-to-complex Inverse Discrete Fourier Transform |
6129 | 6136 |
|
6130 | 6137 | This method computes the complex-to-complex inverse discrete Fourier |
6131 | | -transform. Ignoring the batch dimension, it computes the following |
| 6138 | +transform. Ignoring the batch dimensions, it computes the following |
6132 | 6139 | expression: |
6133 | 6140 |
|
6134 | 6141 | .. math:: |
|
6155 | 6162 | :func:`torch.backends.mkl.is_available` to check if MKL is installed. |
6156 | 6163 |
|
6157 | 6164 | Arguments: |
6158 | | - input (Tensor): the input tensor |
| 6165 | + input (Tensor): the input tensor of at least :attr:`signal_ndim` ``+ 1`` |
| 6166 | + dimensions |
6159 | 6167 | signal_ndim (int): the number of dimensions in each signal. |
6160 | 6168 | :attr:`signal_ndim` can only be 1, 2 or 3 |
6161 | 6169 | normalized (bool, optional): controls whether to return normalized results. |
|
6217 | 6225 | formats of the input and output. |
6218 | 6226 |
|
6219 | 6227 | This method supports 1D, 2D and 3D real-to-complex transforms, indicated |
6220 | | -by :attr:`signal_ndim`. :attr:`input` must be a tensor with ``signal_ndim`` |
6221 | | -dimensions or ``signal_ndim + 1`` dimensions with batched data. If |
6222 | | -:attr:`normalized` is set to ``True``, this normalizes the result by multiplying |
6223 | | -it with :math:`\sqrt{\prod_{i=1}^K N_i}` so that the operator is unitary, where |
6224 | | -:math:`N_i` is the size of signal dimension :math:`i`. |
| 6228 | +by :attr:`signal_ndim`. :attr:`input` must be a tensor with at least |
| 6229 | +``signal_ndim`` dimensions with optionally arbitrary number of leading batch |
| 6230 | +dimensions. If :attr:`normalized` is set to ``True``, this normalizes the result |
| 6231 | +by multiplying it with :math:`\sqrt{\prod_{i=1}^K N_i}` so that the operator is |
| 6232 | +unitary, where :math:`N_i` is the size of signal dimension :math:`i`. |
6225 | 6233 |
|
6226 | 6234 | The real-to-complex Fourier transform results follow conjugate symmetry: |
6227 | 6235 |
|
|
6243 | 6251 | :func:`torch.backends.mkl.is_available` to check if MKL is installed. |
6244 | 6252 |
|
6245 | 6253 | Arguments: |
6246 | | - input (Tensor): the input tensor |
| 6254 | + input (Tensor): the input tensor of at least :attr:`signal_ndim` dimensions |
6247 | 6255 | signal_ndim (int): the number of dimensions in each signal. |
6248 | 6256 | :attr:`signal_ndim` can only be 1, 2 or 3 |
6249 | 6257 | normalized (bool, optional): controls whether to return normalized results. |
|
6287 | 6295 | ``rfft(signal, onesided=True)``. In such case, set the :attr:`onesided` |
6288 | 6296 | argument of this method to ``True``. Moreover, the original signal shape |
6289 | 6297 | information can sometimes be lost, optionally set :attr:`signal_sizes` to be |
6290 | | -the size of the original signal (without batch dimension if in batched mode) to |
6291 | | -recover it with correct shape. |
| 6298 | +the size of the original signal (without the batch dimensions if in batched |
| 6299 | +mode) to recover it with correct shape. |
6292 | 6300 |
|
6293 | 6301 | Therefore, to invert an :func:`~torch.rfft`, the :attr:`normalized` and |
6294 | 6302 | :attr:`onesided` arguments should be set identically for :func:`~torch.irfft`, |
|
6313 | 6321 | :func:`torch.backends.mkl.is_available` to check if MKL is installed. |
6314 | 6322 |
|
6315 | 6323 | Arguments: |
6316 | | - input (Tensor): the input tensor |
| 6324 | + input (Tensor): the input tensor of at least :attr:`signal_ndim` ``+ 1`` |
| 6325 | + dimensions |
6317 | 6326 | signal_ndim (int): the number of dimensions in each signal. |
6318 | 6327 | :attr:`signal_ndim` can only be 1, 2 or 3 |
6319 | 6328 | normalized (bool, optional): controls whether to return normalized results. |
|
0 commit comments