code: def _check_model(self, m, x, trace=False):
      old_fusion_inlining = torch._C._debug_get_fusion_group_inlining()
      torch._C._debug_set_fusion_group_inlining(False)
  
      old_cpu_fuser_state = torch._C._jit_can_fuse_on_cpu()
      torch._C._jit_override_can_fuse_on_cpu(True)
  
      old_te_must_use_llvm_cpu = (
          torch._C._jit_get_te_must_use_llvm_cpu()
      )
      torch._C._jit_set_te_must_use_llvm_cpu(False)
  
      m.eval()
      with torch.no_grad():
          if trace:
              script = torch.jit.trace(m, x)
          else:
              script = torch.jit.script(m)
      script = torch.jit.freeze(script)
  
      with torch.no_grad():
          y = warmup_and_run_forward(script, x)
          y = script(x)
          y_ref = m(x)
  
          graph = script.graph_for(*x)
          self.assertEqual(y, y_ref)
  
      torch._C._debug_set_fusion_group_inlining(old_fusion_inlining)
      torch._C._jit_override_can_fuse_on_cpu(old_cpu_fuser_state)
      torch._C._jit_set_te_must_use_llvm_cpu(old_te_must_use_llvm_cpu)
      return graph
  
imports: import itertools
  import unittest
  from typing import NamedTuple, List
  import torch
  from torch import nn
  from torch.testing._internal.common_utils import run_tests
  from torch.testing._internal.jit_utils import JitTestCase
  from test_tensorexpr import warmup_and_run_forward
label_desc: Use image node_id 2 for calling the TestMkldnnFusion obj's underlying member method code with example usage: obj._check_model(m, x, trace) and returns: graph