def test_forward_case_2(self):
        layer = TanhLayer()
        layer.initialize_parameters()
        x = np.array([[-3.0, 4.0]])
        actual = layer.forward(x)

        x_torch = self.numpy_to_torch(x)
        expect_torch = torch.tanh(x_torch)
        expect = self.torch_to_numpy(expect_torch)

        self.assertEquals(expect.shape, actual.shape)
        self.assertClose(expect, actual)
    def test_backward_cast_2(self):
        layer = TanhLayer()
        layer.initialize_parameters()
        x = np.array([[-3.0, 4.0]])
        y = layer.forward(x)
        dy = np.ones(y.shape)
        dx_actual = layer.backward(dy)

        x_torch = self.numpy_to_torch(x, requires_grad=True)
        y_torch = torch.tanh(x_torch)
        dy_torch = torch.ones(y_torch.shape)
        y_torch.backward(gradient=dy_torch)
        dx_torch = x_torch.grad
        dx_expect = self.torch_to_numpy(dx_torch)

        self.assertEquals(dx_actual.shape, dx_expect.shape)
        self.assertClose(dx_expect, dx_actual)