def test_dense_multiple_layers(): x = torch.randn(2, 10) l1 = Dense(5, input_dim=10) l2 = Dense(3, input_dim=5) y = l1.forward(x) assert y.size() == (2, 5) y = l2.forward(y) assert y.size() == (2, 3)
def test_relu_output_size(): x = torch.randn(2, 2) l1 = Dense(3, input_dim=2) l2 = Activation('relu') y = l1.forward(x) y = l2.forward(y) assert y.size() == (2, 3) assert (y.data >= 0).sum() == 6
def test_dense_layer_forward(): x = torch.randn(2, 10) l = Dense(5, input_dim=10) y = l.forward(x) assert y.size() == (2, 5)