(self, dev)
| 2198 | self._xor_broadcast_helper(gpu_dev) |
| 2199 | |
| 2200 | def _greater_broadcast_helper(self, dev): |
| 2201 | cases = [ |
| 2202 | ([3, 4, 5], [5]), # 3d vs 1d |
| 2203 | ([3, 4, 5], [4, 5]), # 3d vs 2d |
| 2204 | ([3, 4, 5, 6], [5, 6]), # 4d vs 2d |
| 2205 | ([3, 4, 5, 6], [4, 5, 6]), # 4d vs 3d |
| 2206 | ([1, 4, 1, 6], [3, 1, 5, 6]) # 4d vs 4d |
| 2207 | ] |
| 2208 | for in1, in2 in cases: |
| 2209 | x = np.random.randn(*in1).astype(np.float32) |
| 2210 | x1 = np.random.randn(*in2).astype(np.float32) |
| 2211 | y = np.greater(x, x1) |
| 2212 | |
| 2213 | x = tensor.from_numpy(x) |
| 2214 | x1 = tensor.from_numpy(x1) |
| 2215 | x.to_device(dev) |
| 2216 | x1.to_device(dev) |
| 2217 | |
| 2218 | result = autograd.greater(x, x1) |
| 2219 | np.testing.assert_array_almost_equal(tensor.to_numpy(result), |
| 2220 | y, |
| 2221 | decimal=5) |
| 2222 | |
| 2223 | def test_greater_broadcast_cpu(self): |
| 2224 | self._greater_broadcast_helper(cpu_dev) |
no test coverage detected