MCPcopy Create free account
hub / github.com/OpenNMT/CTranslate2 / TEST_P

Function TEST_P

tests/storage_view_test.cc:67–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65};
66
67TEST_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
77INSTANTIATE_TEST_SUITE_P(CPU, StorageViewDeviceTest, ::testing::Values(Device::CPU));
78#ifdef CT2_WITH_CUDA

Callers

nothing calls this directly

Calls 5

expect_storage_eqFunction · 0.85
reserved_memoryMethod · 0.80
to_float16Method · 0.80
to_float32Method · 0.80
dtypeMethod · 0.45

Tested by

no test coverage detected