in optimum/exporters/onnx/config.py [0:0]
def inputs(self) -> Dict[str, Dict[int, str]]:
common_inputs = {}
if self._behavior is not ConfigBehavior.DECODER:
common_inputs["input_ids"] = {0: "batch_size", 1: "encoder_sequence_length"}
common_inputs["attention_mask"] = {0: "batch_size", 1: "encoder_sequence_length"}
if self._behavior is not ConfigBehavior.ENCODER:
if self.use_past_in_inputs:
# TODO: validate the axis name for attention_mask
# common_inputs["attention_mask"][1] = "past_encoder_sequence_length + sequence_length"
common_inputs["decoder_input_ids"] = {0: "batch_size"}
self.add_past_key_values(common_inputs, direction="inputs")
else:
common_inputs["decoder_input_ids"] = {0: "batch_size", 1: "decoder_sequence_length"}
if self._behavior is ConfigBehavior.DECODER:
common_inputs["encoder_outputs"] = {0: "batch_size", 1: "encoder_sequence_length"}
return common_inputs