import tensorflow as tf

  def test_default_encoding_stage(self):
    """Tests the correctness of `default_encoding_stage`."""
    stage = self.default_encoding_stage()
    self.assertIsInstance(stage,
                          (encoding_stage.EncodingStageInterface,
                           encoding_stage.AdaptiveEncodingStageInterface))
    # Calling the method again should create a new instance.
    new_stage = self.default_encoding_stage()
    self.assertIsNot(stage, new_stage)

  def test_encoding_stage_constructor_does_not_modify_graph(self):
    """Tests that the constructor of encoding stage does not modify graph."""
    graph_def = tf.get_default_graph().as_graph_def()
    self.default_encoding_stage()
    new_graph_def = tf.get_default_graph().as_graph_def()
    tf.test.assert_equal_graph_def(graph_def, new_graph_def)

  def test_encoding_stage_name(self):
    """Tests that the `name` property returns a string."""
    stage = self.default_encoding_stage()
    self.assertIsInstance(stage.name, str)

  def test_default_input_is_tensor_with_fully_defined_shape(self):
    """Tests that `default_input` returns a `Tesnor` of fully defined shape."""
    x = self.default_input()
    self.assertIsInstance(x, tf.Tensor)
    self.assertTrue(x.shape.is_fully_defined())

