code: def _create_traced_decoder(
      decoder, input_ids, encoder_state, attention_mask, past=None
  ):
      decoder_c = copy.deepcopy(decoder)
      decoder_for_onnx = DecoderForONNX(decoder_c)
      past_values = list(itertools.chain.from_iterable(past or ()))
  
      # Do this twice so we got 2 different decoders for further work.
      if past_values:
          return torch.jit.trace(
              decoder_for_onnx,
              (input_ids, encoder_state, attention_mask, past_values),
          )
      else:
          return torch.jit.trace(
              decoder_for_onnx,
              (input_ids, encoder_state, attention_mask),
          )
  
imports: import copy
  import itertools
  from typing import List, Optional, Tuple
  import torch
  import torch.nn.functional
  from transformers import BartConfig
  from transformers.generation import GenerationMixin
label_desc: Use image node_id 3 for calling a global function with example usage: _create_traced_decoder(decoder, input_ids, encoder_state, attention_mask, past) and returns: torch, torch