def test_network():
    from NN.loss import MSELoss
    x = np.random.randn(100, 10)
    y = np.random.randn(100, 3)
    net = layer.Network(layer.FullyConnected(10, 20), layer.Tanh(), layer.FullyConnected(20, 3), layer.Tanh())
    mse = MSELoss()
    layer.train(net, (x, y), 10)
    (yhat, _) = net.forward(x)
    initloss = mse.loss(y, yhat)
    layer.train(net, (x, y), 10)
    (yhat, _) = net.forward(x)
    finloss = mse.loss(yhat, y)
    assert (initloss > finloss)
def test_network():
    from NN.loss import MSELoss
    x = np.random.randn(100, 10)
    y = np.random.randn(100, 3)
    net = layer.Network(layer.FullyConnected(10, 20), layer.Tanh(), layer.FullyConnected(20, 3), layer.Tanh())
    mse = MSELoss()
    layer.train(net, (x, y), 10)
    (yhat, _) = net.forward(x)
    initloss = mse.loss(y, yhat)
    layer.train(net, (x, y), 10)
    (yhat, _) = net.forward(x)
    finloss = mse.loss(yhat, y)
    assert (initloss > finloss)