class_docstr: Tests export of StableDropout module.
class_docstr_tok: ["Tests","export","of","StableDropout","module","."]
docstr: Tests export of StableDropout in training mode.
docstr_tok: ["Tests","export","of","StableDropout","in","training","mode","."]
code: def test_training(self):
      """Tests export of StableDropout in training mode."""
      devnull = open(os.devnull, "wb")
      # drop_prob must be > 0 for the test to be meaningful
      sd = modeling_deberta.StableDropout(0.1)
      # Avoid warnings in training mode
      do_constant_folding = False
      # Dropout is a no-op in inference mode
      training = torch.onnx.TrainingMode.PRESERVE
      input = (torch.randn(2, 2),)
  
      torch.onnx.export(
          sd,
          input,
          devnull,
          opset_version=12,  # Minimum supported
          do_constant_folding=do_constant_folding,
          training=training,
      )
  
      # Expected to fail with opset_version < 12
      with self.assertRaises(Exception):
          torch.onnx.export(
              sd,
              input,
              devnull,
              opset_version=11,
              do_constant_folding=do_constant_folding,
              training=training,
          )
  
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 1 for calling the StableDropoutTestCase obj's underlying member method code with example usage: obj.test_training() without return types