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()})
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()})
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})
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)
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)