Fix Windows build and test in CI (#11716)

Summary:
This PR adds Windows support for the C++ frontend. A lot of declarations were missing `TORCH_API` macros, and lots of code just did not compile on MSVC.

ebetica ezyang orionr
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11716

Reviewed By: orionr

Differential Revision: D13038253

Pulled By: goldsborough

fbshipit-source-id: c8e5a45efd26117aeb99e768b56fcd5a89fcb9f8
This commit is contained in:
Peter Goldsborough
2018-11-13 16:30:05 -08:00
committed by Facebook Github Bot
parent f649d8b3a9
commit 8311bbee7f
52 changed files with 238 additions and 193 deletions
+8 -6
View File
@@ -3,8 +3,8 @@
#include <torch/nn/module.h>
#include <torch/nn/modules/linear.h>
#include <torch/nn/modules/rnn.h>
#include <torch/types.h>
#include <torch/nn/modules/sequential.h>
#include <torch/types.h>
#include <torch/utils.h>
#include <test/cpp/api/support.h>
@@ -149,10 +149,10 @@ TEST_F(ModuleTest, CanGetName) {
AGIUnit agi;
// Call it twice just to make sure there are no bugs in the lazy
// initialization semantics.
EXPECT_TRUE(agi.name() == "AGIUnit");
EXPECT_TRUE(agi.name() == "AGIUnit");
EXPECT_TRUE(test::AGIUnit().name() == "test::AGIUnit");
EXPECT_TRUE(test::AGIUnit2().name() == "Foo");
EXPECT_EQ(agi.name(), "AGIUnit");
EXPECT_EQ(agi.name(), "AGIUnit");
EXPECT_EQ(test::AGIUnit().name(), "test::AGIUnit");
EXPECT_EQ(test::AGIUnit2().name(), "Foo");
}
TEST_F(ModuleTest, AsCastsModulesCorrectly) {
@@ -398,7 +398,9 @@ TEST_F(ModuleTest, CloneToDevicePreservesTheDeviceOfParameters_CUDA) {
}
}
TEST_F(ModuleTest, CloningToAParticularDevicePlacesAllParametersThere_CUDA) {
TEST_F(
ModuleTest,
CloningToAParticularDevicePlacesAllParametersThere_MultiCUDA) {
struct TestModule : public Cloneable<TestModule> {
TestModule() {
reset();