MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / TEST_F

Function TEST_F

tests/test_tensor_ops_comparison.cpp:129–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127// ============================================================================
128
129TEST_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
143TEST_F(TensorBugHuntingTest, CPUToGPUTransferMultipleValues) {
144 auto t = lfs::core::Tensor::zeros({5, 4}, lfs::core::Device::CPU);

Callers

nothing calls this directly

Calls 15

fullFunction · 0.85
from_vectorFunction · 0.85
TensorOptionsClass · 0.85
bool_tensors_equalFunction · 0.85
accessorFunction · 0.85
mulMethod · 0.80
to_vectorMethod · 0.80
numelMethod · 0.80
unsqueezeMethod · 0.80
squeezeMethod · 0.80
is_emptyMethod · 0.80
to_vector_intMethod · 0.80

Tested by

no test coverage detected