(self, dev)
| 561 | self._numerical_gradients_check_for_lstm_helper(gpu_dev) |
| 562 | |
| 563 | def _MeanSquareError_helper(self, dev): |
| 564 | X = np.array([4.3, 5.4, 3.3, 3.6, 5.7, |
| 565 | 6.0]).reshape(3, 2).astype(np.float32) |
| 566 | T = np.array([4.4, 5.3, 3.2, 3.7, 5.4, |
| 567 | 6.3]).reshape(3, 2).astype(np.float32) |
| 568 | x = tensor.from_numpy(X) |
| 569 | t = tensor.from_numpy(T) |
| 570 | x.to_device(dev) |
| 571 | t.to_device(dev) |
| 572 | |
| 573 | loss = autograd.mse_loss(x, t) |
| 574 | dx = loss.creator.backward() |
| 575 | |
| 576 | loss_np = tensor.to_numpy(loss)[0] |
| 577 | self.assertAlmostEqual(loss_np, 0.0366666, places=4) |
| 578 | self.check_shape(dx.shape(), (3, 2)) |
| 579 | |
| 580 | def test_MeanSquareError_cpu(self): |
| 581 | self._MeanSquareError_helper(cpu_dev) |
no test coverage detected