def _decode_input_tensor_to_features_dict(feature_map, hparams):
  """Convert the interactive input format (see above) to a dictionary.

  Args:
    feature_map: dict with inputs.
    hparams: model hyperparameters

  Returns:
    A features dictionary, as expected by the decoder.
  """
  x = tf.convert_to_tensor(feature_map["inputs"])
  t = tf.convert_to_tensor(feature_map["target_tags"])

  # Add a third empty dimension.
  x = tf.to_int32(tf.expand_dims(x, axis=[2]))
  t = tf.to_int32(tf.expand_dims(t, axis=[2]))

  p_hparams = hparams.problem_hparams
  input_space_id = tf.constant(p_hparams.input_space_id)
  target_space_id = tf.constant(p_hparams.target_space_id)

  features = {}
  features["input_space_id"] = input_space_id
  features["target_space_id"] = target_space_id
  features["decode_length"] = tf.shape(x)[1] + 50
  features["inputs"] = x
  features["target_tags"] = t

  return features
Convert the interactive input format (see above) to a dictionary.

  Args:
    feature_map: dict with inputs.
    hparams: model hyperparameters

  Returns:
    A features dictionary, as expected by the decoder.
  
language/labs/consistent_zero_shot_nmt/utils/t2t_tweaks.py