pytorch/test/cpp/api/fft.cpp
Mike Ruberry f4695203c2 Fixes fft function calls for C++ API (#43749)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/43732.

Requires importing the fft namespace in the C++ API, just like the Python API does, to avoid clobbering torch::fft the function.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/43749

Reviewed By: glaringlee

Differential Revision: D23391544

Pulled By: mruberry

fbshipit-source-id: d477d0b6d9a689d5c154ad6c31213a7d96fdf271
2020-08-28 12:41:30 -07:00

26 lines
660 B
C++

#include <gtest/gtest.h>
#include <torch/torch.h>
#include <test/cpp/api/support.h>
// Tests that the fft function can be called as usual
TEST(FFTTest, unclobbered_fft) {
auto t = torch::randn({64, 2}, torch::dtype(torch::kDouble));
torch::fft(t, 1);
}
// Clobbers torch::fft the function with torch::fft the namespace
#include <torch/fft.h>
// NOTE: Visual Studio and ROCm builds don't understand complex literals
// as of August 2020
// Simple test that verifies the fft namespace is registered properly
// properly in C++
TEST(FFTTest, fft) {
auto t = torch::randn(128, torch::dtype(torch::kComplexDouble));
torch::fft::fft(t);
}