(self, dev)
| 1609 | self._max_3inputs_helper(gpu_dev) |
| 1610 | |
| 1611 | def _max_1inputs_helper(self, dev): |
| 1612 | data_0 = np.array([3, 2, 1]).astype(np.float32) |
| 1613 | XT = np.array([3, 2, 1]).astype(np.float32) |
| 1614 | |
| 1615 | DY = np.array([1, 1, 1]).astype(np.float32) |
| 1616 | x0 = tensor.from_numpy(data_0) |
| 1617 | dy = tensor.from_numpy(DY) |
| 1618 | x0.to_device(dev) |
| 1619 | dy.to_device(dev) |
| 1620 | |
| 1621 | result = autograd.max(x0) |
| 1622 | dx0 = result.creator.backward(dy.data) |
| 1623 | |
| 1624 | DX0 = np.array([1, 1, 1]).astype(np.float32) |
| 1625 | |
| 1626 | np.testing.assert_array_almost_equal(tensor.to_numpy(result), |
| 1627 | XT, |
| 1628 | decimal=5) |
| 1629 | |
| 1630 | def test_max_1inputs_cpu(self): |
| 1631 | self._max_1inputs_helper(cpu_dev) |
no test coverage detected