| 127 | // ============================================================================ |
| 128 | |
| 129 | TEST_F(TensorBugHuntingTest, CriticalCPUToGPUTransfer) { |
| 130 | // The critical test mentioned in the requirements |
| 131 | auto t = lfs::core::Tensor::ones({2, 3}, lfs::core::Device::CPU); |
| 132 | t.ptr<float>()[0] = 99.0f; |
| 133 | |
| 134 | auto gpu = t.cuda(); |
| 135 | auto back = gpu.cpu(); |
| 136 | |
| 137 | EXPECT_FLOAT_EQ(back.ptr<float>()[0], 99.0f) << "CPU→GPU→CPU transfer corrupted data!"; |
| 138 | |
| 139 | // Also test via operator[] |
| 140 | EXPECT_FLOAT_EQ(back[0][0], 99.0f) << "Operator[] access shows corrupted data!"; |
| 141 | } |
| 142 | |
| 143 | TEST_F(TensorBugHuntingTest, CPUToGPUTransferMultipleValues) { |
| 144 | auto t = lfs::core::Tensor::zeros({5, 4}, lfs::core::Device::CPU); |
nothing calls this directly
no test coverage detected