b4984bf716560a3f5e71c0d5e35cf6b9bd99c211,opennmt/tests/model_test.py,ModelTest,testSequenceToSequenceWithReplaceUnknownTarget,#ModelTest#,179

Before Change


  def testSequenceToSequenceWithReplaceUnknownTarget(self):
    mode = tf.estimator.ModeKeys.PREDICT
    model = catalog.NMTSmall()
    params = model.auto_config()["params"]
    params["replace_unknown_target"] = True
    features_file, _, data_config = self._makeToyEnDeData()
    features = model.input_fn(mode, 16, data_config, features_file)()
    estimator_spec = model.model_fn()(features, None, params, mode, None)

After Change


    model.initialize(data_config)
    with tf.Graph().as_default():
      dataset = estimator.make_input_fn(model, mode, 16, features_file, labels_file)()
      iterator = tf.compat.v1.data.make_initializable_iterator(dataset)
      features = iterator.get_next()
      estimator_spec = estimator.make_model_fn(model)(features, None, params, mode, None)
      with self.session() as sess:
        sess.run(tf.compat.v1.global_variables_initializer())
        sess.run(tf.compat.v1.local_variables_initializer())
        sess.run(tf.compat.v1.tables_initializer())
        sess.run(iterator.initializer)
        _ = sess.run(estimator_spec.predictions)

  def testSequenceToSequenceServing(self):
    // Test that serving features can be forwarded into the model.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: OpenNMT/OpenNMT-tf
Commit Name: b4984bf716560a3f5e71c0d5e35cf6b9bd99c211
Time: 2019-04-01
Author: guillaume.klein@systrangroup.com
File Name: opennmt/tests/model_test.py
Class Name: ModelTest
Method Name: testSequenceToSequenceWithReplaceUnknownTarget


Project Name: OpenNMT/OpenNMT-tf
Commit Name: c77f0a5bcc77286af395b8ed328b9bb5d98e8490
Time: 2019-02-26
Author: guillaume.klein@systrangroup.com
File Name: opennmt/runner.py
Class Name: Runner
Method Name: score


Project Name: tensorflow/magenta
Commit Name: 982740ee6e56d674e3f220d7bf215ae4132c9c1c
Time: 2019-02-22
Author: fjord@google.com
File Name: magenta/models/onsets_frames_transcription/data_test.py
Class Name: DataTest
Method Name: _ValidateProvideBatch