src/transformers/models/t5/configuration_t5.py/T5OnnxConfig/generate_dummy_inputs
class T5OnnxConfig:    def generate_dummy_inputs(
        self,
        tokenizer: PreTrainedTokenizer,
        batch_size: int = -1,
        seq_length: int = -1,
        is_pair: bool = False,
        framework: Optional[TensorType] = None,
    ) -> Mapping[str, Any]:

        # Generate encoder inputs
        encoder_inputs = super().generate_dummy_inputs(tokenizer, batch_size, seq_length, is_pair, framework)

        # Generate decoder inputs
        decoder_inputs = super().generate_dummy_inputs(tokenizer, batch_size, 1, is_pair, framework)
        decoder_inputs = {f"decoder_{name}": tensor for name, tensor in decoder_inputs.items()}

        ordered_inputs = dict(**encoder_inputs, **decoder_inputs)
        if self.use_past:
            if not is_torch_available():
                raise ValueError("Cannot generate dummy past_keys inputs without PyTorch installed.")
            else:
                import torch
            batch = encoder_inputs["input_ids"].shape[0]
            encoder_seq_length = encoder_inputs["input_ids"].shape[1]
            encoder_shape = (
                batch,
                self._config.num_heads,
                encoder_seq_length,
                self._config.hidden_size // self._config.num_heads,
            )
            decoder_shape = (batch, self._config.num_heads, 1, self._config.hidden_size // self._config.num_heads)

            ordered_inputs["past_key_values"] = []
            for _ in range(self._config.num_layers):
                ordered_inputs["past_key_values"].append(
                    (
                        torch.zeros(decoder_shape),
                        torch.zeros(decoder_shape),
                        torch.zeros(encoder_shape),
                        torch.zeros(encoder_shape),
                    )
                )

        return ordered_inputs