Exemplo n.º 1
0
        public TorchTensor ifft2(long[] s = null, long[] dim = null, FFTNormType norm = FFTNormType.Backward)
        {
            if (this.Dimensions < 2)
            {
                throw new ArgumentException("ifft2() input should be at least 2D");
            }
            if (dim == null)
            {
                dim = new long[] { -2, -1 }
            }
            ;
            unsafe
            {
                fixed(long *ps = s, pDim = dim)
                {
                    var res = THSTensor_ifft2(handle, (IntPtr)ps, (IntPtr)pDim, (sbyte)norm);

                    if (res == IntPtr.Zero)
                    {
                        Torch.CheckForErrors();
                    }
                    return(new TorchTensor(res));
                }
            }
        }
Exemplo n.º 2
0
            /// <summary>
            /// Computes the one dimensional inverse discrete Fourier transform of input.
            /// </summary>
            /// <param name="input">The input tensor</param>
            /// <param name="n">Signal length. If given, the input will either be zero-padded or trimmed to this length before computing the IFFT.</param>
            /// <param name="dim">The dimension along which to take the one dimensional IFFT.</param>
            /// <param name="norm">Normalization mode.</param>
            /// <returns></returns>
            public static Tensor ifft(Tensor input, long n = -1, long dim = -1, FFTNormType norm = FFTNormType.Backward)
            {
                var res = THSTensor_ifft(input.Handle, n, dim, (sbyte)norm);

                if (res == IntPtr.Zero)
                {
                    torch.CheckForErrors();
                }
                return(new Tensor(res));
            }
Exemplo n.º 3
0
        public TorchTensor ifft(long n = -1, long dim = -1, FFTNormType norm = FFTNormType.Backward)
        {
            var res = THSTensor_ifft(handle, n, dim, (sbyte)norm);

            if (res == IntPtr.Zero)
            {
                Torch.CheckForErrors();
            }
            return(new TorchTensor(res));
        }
Exemplo n.º 4
0
        public TorchTensor irfftn(long[] s = null, long[] dim = null, FFTNormType norm = FFTNormType.Backward)
        {
            var slen = (s == null) ? 0 : s.Length;
            var dlen = (dim == null) ? 0 : dim.Length;

            unsafe
            {
                fixed(long *ps = s, pDim = dim)
                {
                    var res = THSTensor_irfftn(handle, (IntPtr)ps, slen, (IntPtr)pDim, dlen, (sbyte)norm);

                    if (res == IntPtr.Zero)
                    {
                        Torch.CheckForErrors();
                    }
                    return(new TorchTensor(res));
                }
            }
        }