message: Add unit tests for get layer.
diff: @@ -175,6 +175,35 @@ class NetworkConstructionTest(keras_parameterized.TestCase):
  self.assertEqual(len(network.get_losses_for(x4)), 1)
  self.assertEqual(len(network.get_losses_for(None)), 1)
  + def test_get_layer(self):
  + # create a simple network
  + x = input_layer_lib.Input(shape=(32,))
  + dense_a = keras.layers.Dense(4, name='dense_a')
  + dense_b = keras.layers.Dense(2, name='dense_b')
  + y = dense_b(dense_a(x))
  + network = network_lib.Network(x, y, name='dense_network')
  +
  + # test various get_layer by index
  + self.assertEqual(network.get_layer(index=1), dense_a)
  +
  + # test invalid get_layer by index
  + with self.assertRaises(ValueError):
  + network.get_layer(index=3)
  +
  + # test priority of index over name
  + self.assertEqual(network.get_layer(index=1, name='dense_b'), dense_a)
  +
  + # test that a name or an index must be provided
  + with self.assertRaises(ValueError):
  + network.get_layer()
  +
  + # test various get_layer by name
  + self.assertEqual(network.get_layer(name='dense_a'), dense_a)
  +
  + # test invalid get_layer by name
  + with self.assertRaises(ValueError):
  + network.get_layer(name='dense_c')
  +
  @test_util.run_in_graph_and_eager_modes()
  def testTopologicalAttributes(self):
  # test layer attributes / methods related to cross-layer connectivity.
  