def test_forward_pass_single_samples(self): lc = RectifiedLinear(1, 1) for x, t in zip(self.X, self.T): t = np.atleast_2d(t) x = np.atleast_2d(x) out_buf = np.zeros_like(t) lc.forward_pass(np.array([]), [x], out_buf) assert_allclose(out_buf, t)
def test_forward_pass_multi_sample(self): lc = RectifiedLinear(1, 1) out_buf = np.zeros(self.T.shape, dtype=self.T.dtype) lc.forward_pass(np.array([]), [self.X], out_buf) assert_allclose(out_buf, self.T)
def test_dimensions(self): lc = RectifiedLinear(5, 5) self.assertEqual(lc.input_dim, 5) self.assertEqual(lc.output_dim, 5) self.assertEqual(lc.get_param_dim(), 0)
def test_backprop_multisample(self): lc = RectifiedLinear(1, 1) assert_backprop_correct(lc, np.array([]), [self.X], np.ones_like(self.T))