| 65 | }; |
| 66 | |
| 67 | TEST_P(StorageViewDeviceTest, HalfConversion) { |
| 68 | const Device device = GetParam(); |
| 69 | const StorageView a({4}, std::vector<float>{1, 2, 3, 4}, device); |
| 70 | EXPECT_EQ(a.reserved_memory(), 4 * 4); |
| 71 | const StorageView b = a.to_float16(); |
| 72 | EXPECT_EQ(b.dtype(), DataType::FLOAT16); |
| 73 | EXPECT_EQ(b.reserved_memory(), 4 * 2); |
| 74 | expect_storage_eq(b.to_float32(), a); |
| 75 | } |
| 76 | |
| 77 | INSTANTIATE_TEST_SUITE_P(CPU, StorageViewDeviceTest, ::testing::Values(Device::CPU)); |
| 78 | #ifdef CT2_WITH_CUDA |
nothing calls this directly
no test coverage detected