Learn R Programming

torch (version 0.2.0)

torch_irfft: Irfft

Description

Irfft

Usage

torch_irfft(
  self,
  signal_ndim,
  normalized = FALSE,
  onesided = TRUE,
  signal_sizes = list()
)

Arguments

self

(Tensor) the input tensor of at least signal_ndim + 1 dimensions

signal_ndim

(int) the number of dimensions in each signal. signal_ndim can only be 1, 2 or 3

normalized

(bool, optional) controls whether to return normalized results. Default: FALSE

onesided

(bool, optional) controls whether input was halfed to avoid redundancy, e.g., by torch_rfft(). Default: TRUE

signal_sizes

(list or torch.Size, optional) the size of the original signal (without batch dimension). Default: NULL

irfft(input, signal_ndim, normalized=False, onesided=TRUE, signal_sizes=NULL) -> Tensor

Complex-to-real Inverse Discrete Fourier Transform

This method computes the complex-to-real inverse discrete Fourier transform. It is mathematically equivalent with torch_ifft with differences only in formats of the input and output.

The argument specifications are almost identical with torch_ifft. Similar to torch_ifft, if normalized is set to TRUE, this normalizes the result by multiplying it with \(\sqrt{\prod_{i=1}^K N_i}\) so that the operator is unitary, where \(N_i\) is the size of signal dimension \(i\).

Warning

Generally speaking, input to this function should contain values following conjugate symmetry. Note that even if onesided is TRUE, often symmetry on some part is still needed. When this requirement is not satisfied, the behavior of torch_irfft is undefined. Since torch_autograd.gradcheck estimates numerical Jacobian with point perturbations, torch_irfft will almost certainly fail the check.

For CPU tensors, this method is currently only available with MKL. Use torch_backends.mkl.is_available to check if MKL is installed.

Examples

Run this code
# NOT RUN {
if (torch_is_installed()) {

x = torch_randn(c(4, 4))
torch_rfft(x, 2, onesided=TRUE)
x = torch_randn(c(4, 5))
torch_rfft(x, 2, onesided=TRUE)
y = torch_rfft(x, 2, onesided=TRUE)
torch_irfft(y, 2, onesided=TRUE, signal_sizes=c(4,5))  # recover x
}
# }

Run the code above in your browser using DataLab