| 81 | // ============= Abs Tests ============= |
| 82 | |
| 83 | TEST_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 | |
| 95 | TEST_F(TensorMathTest, AbsNegative) { |
| 96 | std::vector<float> data = {-10.0f, -5.0f, -1.0f, -0.5f}; |
nothing calls this directly
no test coverage detected