import tensorflow as tf

    with tf.Session() as sess:
      self.assertTrue(assert_tensors_equal(sess, tensor1, tensor2, 20))

  @tf.contrib.eager.run_test_in_graph_and_eager_modes()
  def testProblemHparamsModality(self):
    problem = problem_hparams.TestProblem(input_vocab_size=2,
                                          target_vocab_size=3)
    p_hparams = problem.get_hparams()
    self.assertIsInstance(p_hparams.modality["inputs"],
                          modalities.SymbolModality)
    self.assertIsInstance(p_hparams.modality["targets"],
                          modalities.SymbolModality)

  @tf.contrib.eager.run_test_in_graph_and_eager_modes()
  def testProblemHparamsModalityObj(self):
    class ModalityObjProblem(problem_module.Problem):

      def hparams(self, defaults, model_hparams):
        hp = defaults
        hp.modality = {"inputs": modalities.SymbolModality,
                       "targets": modalities.SymbolModality}
        hp.vocab_size = {"inputs": 2,
                         "targets": 3}

    problem = ModalityObjProblem(False, False)
    p_hparams = problem.get_hparams()
