code: def test_dropout(self):
      class MyModule(Module):
          def __init__(self):
              super().__init__()
              self.dropout = torch.nn.Dropout(0.5)
  
          def forward(self, x):
              return self.dropout(x)
  
      x = torch.randn(1, 2, 3)
  
      # we should only export the onnx Dropout op in training mode; test both modes
  
      # test training mode
      ops = [
          {
              "op_name": "Dropout",
              "attributes": [{"name": "ratio", "f": 0.5, "type": 1}],
          }
      ]
      ops = {9: ops, 10: ops}
      check_onnx_opsets_operator(
          MyModule(),
          x,
          ops,
          opset_versions=[9, 10],
          training=torch.onnx.TrainingMode.TRAINING,
      )
  
      # test eval mode
      ops = [{"op_name": "Identity"}]
      ops = {9: ops, 10: ops}
      check_onnx_opsets_operator(
          MyModule(),
          x,
          ops,
          opset_versions=[9, 10],
          training=torch.onnx.TrainingMode.EVAL,
      )
  
imports: import io
  import itertools
  import onnx
  import pytorch_test_common
  import torch
  import torch.onnx
  from torch.nn import Module
  from torch.onnx import producer_name, producer_version
  from torch.onnx._globals import GLOBALS
  from torch.testing._internal import common_utils
label_desc: Use image node_id 8 for calling the TestONNXOpset obj's underlying member method code with example usage: obj.test_dropout() and returns: self