@test_util.run_tf1_only
def testSequenceToSequenceServing(self):
// Test that serving features can be forwarded into the model.
model = catalog.NMTSmall()
_, _, data_config = self._makeToyEnDeData()
features = model.serving_input_fn(data_config)().features
with tf.variable_scope(model.name):
_, predictions = model(
features, None, model.auto_config()["params"], tf.estimator.ModeKeys.PREDICT)
self.assertIsInstance(predictions, dict)
@parameterized.expand([
After Change
def testSequenceToSequenceServing(self):
// Test that serving features can be forwarded into the model.
_, _, data_config = self._makeToyEnDeData()
model, params = _seq2seq_model()
model.initialize(data_config)
with tf.Graph().as_default():
features = estimator.make_serving_input_fn(model)().features
_, predictions = model(
features, None, params, tf.estimator.ModeKeys.PREDICT)