def get(encoder_type):
  """Returns an encoder instance of the specified type."""
  if encoder_type == U.ENC_UNI:
    encoder = UniRNNEncoder()
  elif encoder_type == U.ENC_BI:
    encoder = BiRNNEncoder()
  elif encoder_type == U.ENC_GNMT:
    encoder = GNMTEncoder()
  else:
    raise ValueError("Unknown encoder type: %s. The type must be one of %s."
                     % (encoder_type, str(U.ENC_TYPES)))
  return encoder
Returns an encoder instance of the specified type.
language/labs/consistent_zero_shot_nmt/modules/encoders.py