| 82 | // ============= Comparison Operations Tests ============= |
| 83 | |
| 84 | TEST_F(TensorMaskingTest, ComparisonEqual) { |
| 85 | std::vector<float> a_data = {1, 2, 3, 4, 5}; |
| 86 | std::vector<float> b_data = {1, 0, 3, 0, 5}; |
| 87 | |
| 88 | auto a_custom = Tensor::from_vector(a_data, {5}, Device::CUDA); |
| 89 | auto b_custom = Tensor::from_vector(b_data, {5}, Device::CUDA); |
| 90 | auto t = Tensor::zeros({1, 2}); |
| 91 | |
| 92 | auto a_torch = torch::tensor(a_data, torch::kCUDA); |
| 93 | auto b_torch = torch::tensor(b_data, torch::kCUDA); |
| 94 | |
| 95 | auto mask_custom = a_custom.eq(b_custom); |
| 96 | auto mask_torch = a_torch.eq(b_torch); |
| 97 | |
| 98 | compare_tensors(mask_custom, mask_torch, 1e-5f, 1e-7f, "ComparisonEqual"); |
| 99 | |
| 100 | // Test scalar comparison |
| 101 | auto mask2_custom = a_custom.eq(3.0f); |
| 102 | auto mask2_torch = a_torch.eq(3.0f); |
| 103 | |
| 104 | compare_tensors(mask2_custom, mask2_torch, 1e-5f, 1e-7f, "ComparisonEqualScalar"); |
| 105 | } |
| 106 | |
| 107 | TEST_F(TensorMaskingTest, ComparisonLessThan) { |
| 108 | std::vector<float> a_data = {1, 2, 3, 4, 5}; |
nothing calls this directly
no test coverage detected