in optimum/exporters/onnx/model_configs.py [0:0]
def outputs(self) -> Dict[str, Dict[int, str]]:
common_outputs = {}
if self._behavior is ConfigBehavior.ENCODER:
common_outputs["encoder_outputs"] = {1: "encoder_sequence_length"}
common_outputs["encoder_attention_mask"] = {1: "encoder_sequence_length"}
elif self._behavior is ConfigBehavior.DECODER:
common_outputs["output_sequence_out"] = {1: "decoder_sequence_length + 1"}
common_outputs["spectrum"] = {} # No dynamic shape here.
common_outputs["prob"] = {} # No dynamic shape here.
if self.variant == "with-past" and self.use_past:
# When exporting decoder models with use_cache=True, both the decoder without past and with past have the KV cache as an output.
self.add_past_key_values(common_outputs, direction="outputs")
elif self.is_postnet_and_vocoder:
common_outputs["waveform"] = {0: "n_samples"}
else:
raise ValueError(
"self._behavior is neither encoder or decoder, and is_postnet_and_vocoder=False. This should not happen."
)
return common_outputs