| 52 | } // anonymous namespace |
| 53 | |
| 54 | TEST(TestGoptBasicArithInplace, EqToUnit) { |
| 55 | HostTensorGenerator<> gen; |
| 56 | auto graph = ComputingGraph::make(); |
| 57 | auto x = opr::Host2DeviceCopy::make(*graph, gen({2, 3})); |
| 58 | auto a = x - x, b = x / x; |
| 59 | ASSERT_EQ(a.as_immutable_scalar()->get_cast<float>(), 0.f); |
| 60 | ASSERT_EQ(b.as_immutable_scalar()->get_cast<float>(), 1.f); |
| 61 | TensorShape shp{2, 3}; |
| 62 | ASSERT_EQ(a.shape(), shp); |
| 63 | ASSERT_EQ(b.shape(), shp); |
| 64 | } |
| 65 | |
| 66 | TEST(TestGoptBasicArithInplace, ZeroOne) { |
| 67 | HostTensorGenerator<> gen; |
nothing calls this directly
no test coverage detected