Exemplo n.º 1
0
def test_merge():
    layer_1 = core.Layer()
    layer_2 = core.Layer()
    layer_1.set_input_shape((None,))
    layer_2.set_input_shape((None,))
    layer = core.Merge([layer_1, layer_2])
    _runner(layer)
Exemplo n.º 2
0
    def test_connections(self):
        nb_samples = 10
        input_dim = 5
        layer1 = core.Layer()
        layer2 = core.Layer()

        input = np.ones((nb_samples, input_dim))
        layer1.input = theano.shared(value=input)

        # After connecting, input of layer1 should be passed through
        layer2.set_previous(layer1)
        for train in [True, False]:
            assert_allclose(layer2.get_input(train).eval(), input)
            assert_allclose(layer2.get_output(train).eval(), input)
Exemplo n.º 3
0
def test_connections():
    nb_samples = 10
    input_dim = 5
    layer1 = core.Layer()
    layer2 = core.Layer()

    input = np.ones((nb_samples, input_dim))
    layer1.input = K.variable(input)

    # After connecting, input of layer1 should be passed through
    layer2.set_previous(layer1)
    for train in [True, False]:
        assert_allclose(K.eval(layer2.get_input(train)), input)
        assert_allclose(K.eval(layer2.get_output(train)), input)
Exemplo n.º 4
0
    def test_connections(self):
        nb_samples = 10
        input_dim = 5
        layer1 = core.Layer()
        layer2 = core.Layer()

        input = np.ones((nb_samples, input_dim))
        layer1.input = theano.shared(value=input)

        # As long as there is no previous layer, an error should be raised.
        for train in [True, False]:
            self.assertRaises(AttributeError, layer2.get_input, train)

        # After connecting, input of layer1 should be passed through
        layer2.set_previous(layer1)
        for train in [True, False]:
            assert_allclose(layer2.get_input(train).eval(), input)
            assert_allclose(layer2.get_output(train).eval(), input)
Exemplo n.º 5
0
def test_input_output():
    nb_samples = 10
    input_dim = 5
    layer = core.Layer()

    # Once an input is provided, it should be reachable through the
    # appropriate getters
    input = np.ones((nb_samples, input_dim))
    layer.input = K.variable(input)
    for train in [True, False]:
        assert_allclose(K.eval(layer.get_input(train)), input)
        assert_allclose(K.eval(layer.get_output(train)), input)
Exemplo n.º 6
0
    def test_input_output(self):
        nb_samples = 10
        input_dim = 5
        layer = core.Layer()

        # As long as there is no input, an error should be raised.
        for train in [True, False]:
            self.assertRaises(AttributeError, layer.get_input, train)
            self.assertRaises(AttributeError, layer.get_output, train)

        # Once an input is provided, it should be reachable through the
        # appropriate getters
        input = np.ones((nb_samples, input_dim))
        layer.input = theano.shared(value=input)
        for train in [True, False]:
            assert_allclose(layer.get_input(train).eval(), input)
            assert_allclose(layer.get_output(train).eval(), input)
Exemplo n.º 7
0
def test_base():
    layer = core.Layer()
    _runner(layer)
Exemplo n.º 8
0
def test_autoencoder():
    layer_1 = core.Layer()
    layer_2 = core.Layer()

    layer = core.AutoEncoder(layer_1, layer_2)
    _runner(layer)
Exemplo n.º 9
0
 def test_base(self):
     layer = core.Layer()
     self._runner(layer)
Exemplo n.º 10
0
 def test_merge(self):
     layer_1 = core.Layer()
     layer_2 = core.Layer()
     layer = core.Merge([layer_1, layer_2])
     self._runner(layer)