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

Function TEST_F

tests/test_tensor_vs_torch.cpp:239–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237// ============================================================================
238
239TEST_F(TensorVsTorchTest, BasicCreation) {
240 // Test zeros
241 auto torch_zeros = torch::zeros({10, 5}, torch::kCUDA);
242 auto gs_zeros = lfs::core::Tensor::zeros({10, 5}, lfs::core::Device::CUDA);
243 EXPECT_TRUE(tensors_equal(torch_zeros, gs_zeros));
244
245 // Test ones
246 auto torch_ones = torch::ones({10, 5}, torch::kCUDA);
247 auto gs_ones = lfs::core::Tensor::ones({10, 5}, lfs::core::Device::CUDA);
248 EXPECT_TRUE(tensors_equal(torch_ones, gs_ones));
249
250 // Test full
251 auto torch_full = torch::full({10, 5}, 3.14f, torch::kCUDA);
252 auto gs_full = lfs::core::Tensor::full({10, 5}, 3.14f, lfs::core::Device::CUDA);
253 EXPECT_TRUE(tensors_equal(torch_full, gs_full));
254}
255
256TEST_F(TensorVsTorchTest, RandInt) {
257 // Test randint with same seed

Callers

nothing calls this directly

Calls 15

fullFunction · 0.85
manual_seedFunction · 0.85
TensorOptionsClass · 0.85
print_tensor_comparisonFunction · 0.85
from_vectorFunction · 0.85
to_vector_intMethod · 0.80
cdistMethod · 0.80
divMethod · 0.80
cumsumMethod · 0.80
strMethod · 0.80
shapeMethod · 0.80
numelMethod · 0.80

Tested by

no test coverage detected