mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
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
26 lines
660 B
C++
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);
|
|
}
|