dft#
- ivy.dft(x, /, *, axis=1, inverse=False, onesided=False, dft_length=None, norm='backward', out=None)[source]#
Compute the discrete Fourier transform of input.
- Parameters:
x (
Union
[Array
,NativeArray
]) – Input volume […,d_in,…], where d_in indicates the dimension that needs FFT.axis (
int
, default:1
) – The axis on which to perform the DFT. By default this value is set to 1, which corresponds to the first dimension after the batch index.inverse (
bool
, default:False
) – Whether to perform the inverse discrete fourier transform. By default this value is set to False.onesided (
bool
, default:False
) – If onesided is True, only values for w in [0, 1, 2, …, floor(n_fft/2) + 1] are returned because the real-to-complex Fourier transform satisfies the conjugate symmetry, i.e., X[m, w] = X[m,w]=X[m,n_fft-w]*. Note if the input or window tensors are complex, then onesided output is not possible. Enabling onesided with real inputs performs a Real-valued fast Fourier transform (RFFT). When invoked with real or complex valued input, the default value is False. Values can be True or False.dft_length (
Optional
[Union
[int
,Tuple
[int
]]], default:None
) – The length of the signal.If greater than the axis dimension, the signal will be zero-padded up to dft_length. If less than the axis dimension, only the first dft_length values will be used as the signal. It’s an optional value.norm (
str
, default:'backward'
) – Optional argument, “backward”, “ortho” or “forward”. Defaults to be “backward”. “backward” indicates no normalization. “ortho” indicates normalization by 1/sqrt(n). “forward” indicates normalization by 1/n.out (
Optional
[Array
], default:None
) – Optional output array, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
- Returns:
ret – The Fourier Transform of the input vector.If onesided is False, the following shape is expected: [batch_idx][signal_dim1][signal_dim2] …[signal_dimN][2]. If axis=0 and onesided is True, the following shape is expected: [batch_idx][floor(signal_dim1/2)+1][signal_dim2]…[signal_dimN][2]. If axis=1 and onesided is True, the following shape is expected: [batch_idx][signal_dim1][floor(signal_dim2/2)+1]…[signal_dimN][2]. If axis=N-1 and onesided is True, the following shape is expected: [batch_idx][signal_dim1][signal_dim2]…[floor(signal_dimN/2)+1][2]. The signal_dim at the specified axis is equal to the dft_length.
- Array.dft(self, /, *, axis=1, inverse=False, onesided=False, dft_length=None, norm='backward', out=None)[source]#
Compute the discrete Fourier transform of input.
- Parameters:
self – Input volume […,d_in,…], where d_in indicates the dimension that needs FFT.
axis (
int
, default:1
) – The axis on which to perform the DFT. By default this value is set to 1, which corresponds to the first dimension after the batch index.inverse (
bool
, default:False
) – Whether to perform the inverse discrete fourier transform. By default this value is set to False.onesided (
bool
, default:False
) – If onesided is True, only values for w in [0, 1, 2, …, floor(n_fft/2) + 1] are returned because the real-to-complex Fourier transform satisfies the conjugate symmetry, i.e., X[m, w] = X[m,w]=X[m,n_fft-w]*. Note if the input or window tensors are complex, then onesided output is not possible. Enabling onesided with real inputs performs a Real-valued fast Fourier transform (RFFT). When invoked with real or complex valued input, the default value is False. Values can be True or False.dft_length (
Optional
[Union
[int
,Tuple
[int
]]], default:None
) – The length of the signal.If greater than the axis dimension, the signal will be zero-padded up to dft_length. If less than the axis dimension, only the first dft_length values will be used as the signal. It’s an optional value.norm (
str
, default:'backward'
) – Optional argument, “backward”, “ortho” or “forward”. Defaults to be “backward”. “backward” indicates no normalization. “ortho” indicates normalization by 1/sqrt(n). “forward” indicates normalization by 1/n.out (
Optional
[Array
], default:None
) – Optional output array, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
Array
- Returns:
ret – The Fourier Transform of the input vector.If onesided is False, the following shape is expected: [batch_idx][signal_dim1][signal_dim2] …[signal_dimN][2]. If axis=0 and onesided is True, the following shape is expected: [batch_idx][floor(signal_dim1/2)+1][signal_dim2] …[signal_dimN][2]. If axis=1 and onesided is True, the following shape is expected: [batch_idx][signal_dim1] [floor(signal_dim2/2)+1] …[signal_dimN][2]. If axis=N-1 and onesided is True, the following shape is expected: [batch_idx][signal_dim1][signal_dim2]… [floor(signal_dimN/2)+1][2]. The signal_dim at the specified axis is equal to the dft_length.
- Container.dft(self, /, *, axis=1, inverse=False, onesided=False, dft_length=None, norm='backward', key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
- Parameters:
axis (
Union
[int
,Container
], default:1
) –inverse (
Union
[bool
,Container
], default:False
) –onesided (
Union
[bool
,Container
], default:False
) –dft_length (
Optional
[Union
[int
,Tuple
[int
],Container
]], default:None
) –norm (
Union
[str
,Container
], default:'backward'
) –key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) –to_apply (
Union
[bool
,Container
], default:True
) –prune_unapplied (
Union
[bool
,Container
], default:False
) –map_sequences (
Union
[bool
,Container
], default:False
) –out (
Optional
[Union
[Array
,Container
]], default:None
) –
- Return type:
Container