| 15 | } |
| 16 | |
| 17 | TEST(TorchConversionTest, BasicConversion) { |
| 18 | auto lfs_t = lfs::core::Tensor::randn({10, 1}, lfs::core::Device::CUDA); |
| 19 | |
| 20 | // Convert multiple times |
| 21 | auto torch_t1 = to_torch(lfs_t); |
| 22 | auto torch_t2 = to_torch(lfs_t); |
| 23 | |
| 24 | EXPECT_TRUE(torch_t1.defined()); |
| 25 | EXPECT_TRUE(torch_t2.defined()); |
| 26 | EXPECT_TRUE(torch_t1.is_cuda()); |
| 27 | EXPECT_TRUE(torch_t2.is_cuda()); |
| 28 | |
| 29 | // Try sigmoid |
| 30 | auto sig1 = torch::sigmoid(torch_t1); |
| 31 | auto sig2 = torch::sigmoid(torch_t2); |
| 32 | |
| 33 | EXPECT_TRUE(sig1.defined()); |
| 34 | EXPECT_TRUE(sig2.defined()); |
| 35 | } |