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

Function TEST_F

tests/test_tensor_math.cpp:83–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81// ============= Abs Tests =============
82
83TEST_F(TensorMathTest, Abs) {
84 std::vector<float> data = {-3.5f, 2.1f, -1.0f, 0.0f, 4.2f, -5.5f};
85
86 auto tensor_custom = Tensor::from_vector(data, {2, 3}, Device::CUDA);
87 auto tensor_torch = create_torch_tensor(data, {2, 3});
88
89 auto result_custom = tensor_custom.abs();
90 auto result_torch = torch::abs(tensor_torch);
91
92 compare_tensors(result_custom, result_torch, 1e-5f, 1e-7f, "Abs");
93}
94
95TEST_F(TensorMathTest, AbsNegative) {
96 std::vector<float> data = {-10.0f, -5.0f, -1.0f, -0.5f};

Callers

nothing calls this directly

Calls 15

from_vectorFunction · 0.85
logFunction · 0.85
fullFunction · 0.85
to_vectorMethod · 0.80
flattenMethod · 0.80
expMethod · 0.80
sigmoidMethod · 0.80
reluMethod · 0.80
sinMethod · 0.80
cosMethod · 0.80
tanMethod · 0.80
tanhMethod · 0.80

Tested by

no test coverage detected