class_docstr: Cover all the utilities involved to export ONNX models
class_docstr_tok: ["Cover","all","the","utilities","involved","to","export","ONNX","models"]
docstr: When exporting ONNX model with dynamic axis (batch or sequence) we set batch_size and/or sequence_length = -1.
  We cannot generate an effective tensor with axis dim == -1, so we trick by using some "fixed" values
  (> 1 to avoid ONNX squeezing the axis).
  
  This test ensure we are correctly replacing generated batch / sequence tensor with axis > 1
docstr_tok: ["When","exporting","ONNX","model","with","dynamic","axis","(","batch","or","sequence",")","we","set","batch_size","and\/or","sequence_length","=","-1",".","We","can","not","generate","an","effective","tensor","with","axis","dim","==","-1",",","so","we","trick","by","using","some","``","fixed","''","values","(",">","1","to","avoid","ONNX","squeezing","the","axis",")",".","This","test","ensure","we","are","correctly","replacing","generated","batch","\/","sequence","tensor","with","axis",">","1"]
code: def test_compute_effective_axis_dimension(self):
      """
      When exporting ONNX model with dynamic axis (batch or sequence) we set batch_size and/or sequence_length = -1.
      We cannot generate an effective tensor with axis dim == -1, so we trick by using some "fixed" values
      (> 1 to avoid ONNX squeezing the axis).
  
      This test ensure we are correctly replacing generated batch / sequence tensor with axis > 1
      """
  
      # Dynamic axis (batch, no token added by the tokenizer)
      self.assertEqual(
          compute_effective_axis_dimension(
              -1, fixed_dimension=2, num_token_to_add=0
          ),
          2,
      )
  
      # Static axis (batch, no token added by the tokenizer)
      self.assertEqual(
          compute_effective_axis_dimension(
              0, fixed_dimension=2, num_token_to_add=0
          ),
          2,
      )
  
      # Dynamic axis (sequence, token added by the tokenizer 2 (no pair))
      self.assertEqual(
          compute_effective_axis_dimension(
              0, fixed_dimension=8, num_token_to_add=2
          ),
          6,
      )
      self.assertEqual(
          compute_effective_axis_dimension(
              0, fixed_dimension=8, num_token_to_add=2
          ),
          6,
      )
  
      # Dynamic axis (sequence, token added by the tokenizer 3 (pair))
      self.assertEqual(
          compute_effective_axis_dimension(
              0, fixed_dimension=8, num_token_to_add=3
          ),
          5,
      )
      self.assertEqual(
          compute_effective_axis_dimension(
              0, fixed_dimension=8, num_token_to_add=3
          ),
          5,
      )
  
imports: import os
  from pathlib import Path
  from tempfile import NamedTemporaryFile
  from unittest import TestCase
  from unittest.mock import patch
  import pytest
  from parameterized import parameterized
  from transformers import AutoConfig, PreTrainedTokenizerBase, is_tf_available, is_torch_available
  from transformers.onnx import EXTERNAL_DATA_FORMAT_SIZE_LIMIT, OnnxConfig, OnnxConfigWithPast, ParameterFormat, export, validate_model_outputs
  from transformers.onnx.utils import compute_effective_axis_dimension, compute_serialized_parameters_size, get_preprocessor
  from transformers.testing_utils import require_onnx, require_rjieba, require_tf, require_torch, require_vision, slow
label_desc: Use image node_id 2 for calling the OnnxUtilsTestCaseV2 obj's underlying member method code with example usage: obj.test_compute_effective_axis_dimension() without return types