コード例 #1
0
ファイル: test_graph.py プロジェクト: itdxer/neupy
    def test_graph_propagate_forward(self):
        layer_1 = layers.Input(1)
        layer_2 = layers.Input(2)

        graph = LayerGraph()
        graph.add_layer(layer_1)

        with self.assertRaises(ValueError):
            graph.propagate_forward({layer_2: T.matrix()})
コード例 #2
0
    def test_graph_propagate_forward(self):
        layer_1 = layers.Input(1)
        layer_2 = layers.Input(2)

        graph = LayerGraph()
        graph.add_layer(layer_1)

        with self.assertRaises(ValueError):
            graph.propagate_forward({layer_2: T.matrix()})
コード例 #3
0
    def test_graph_propagate_forward(self):
        layer_1 = layers.Input(1)
        layer_2 = layers.Input(2)

        graph = LayerGraph()
        graph.add_layer(layer_1)
        input_value_2 = np.random.random((10, 2))

        with self.assertRaises(ValueError):
            graph.propagate_forward({layer_2: input_value_2})
コード例 #4
0
ファイル: test_graph.py プロジェクト: itdxer/neupy
    def test_subgraph_by_layer(self):
        layer_1 = layers.Input(1)
        layer_2 = layers.Input(2)

        graph = LayerGraph()
        graph.add_layer(layer_1)

        subgraph = graph.subgraph_for_output(layer_1)
        self.assertEqual(len(subgraph.forward_graph), 1)

        subgraph = graph.subgraph_for_output(layer_2)
        self.assertEqual(len(subgraph.forward_graph), 0)
コード例 #5
0
    def test_subgraph_by_layer(self):
        layer_1 = layers.Input(1)
        layer_2 = layers.Input(2)

        graph = LayerGraph()
        graph.add_layer(layer_1)

        subgraph = graph.subgraph_for_output(layer_1)
        self.assertEqual(len(subgraph.forward_graph), 1)

        subgraph = graph.subgraph_for_output(layer_2)
        self.assertEqual(len(subgraph.forward_graph), 0)