code: def test_permute_linear_fusion(self):
      class TestModule(torch.nn.Module):
          def __init__(self, k: int, n: int, has_bias: bool):
              super().__init__()
              self.weight = torch.nn.Parameter(torch.randn(n, k))
              self.has_bias = has_bias
              if has_bias:
                  self.bias = torch.nn.Parameter(torch.randn(n))
  
          def forward(self, input: torch.Tensor):
              input1 = input.permute(0, 2, 1)
              if self.has_bias:
                  return torch.nn.functional.linear(
                      input1, self.weight, self.bias
                  )
              return torch.nn.functional.linear(input1, self.weight)
  
      m, k, n = 16, 8, 4
  
      trace_func = chain_passes(
          torch.fx.symbolic_trace, permute_linear_fusion
      )
      for has_bias in [True, False]:
          module = TestModule(k, n, has_bias).eval()
          input = torch.randn(6, k, m)
          traced = trace_func(module, [input])
          num_linear = count_call_function(
              traced, torch.nn.functional.linear
          )
          num_transpose_linear = count_call_function(
              traced, transpose_linear
          )
          self.assertEqual(num_linear, 0)
          self.assertEqual(num_transpose_linear, 1)
  
          self.assertTrue(torch.allclose(module(input), traced(input)))
  
file_path: pytorch/test/inductor/test_fx_fusion.py
imports: from typing import Any, Callable
  import torch
  from torch._inductor.fx_passes.pre_grad import linear_permute_fusion, linear_transpose, permute_linear_fusion, permute_matmul_fusion, sink_cat_after_pointwise, transpose_linear, transpose_matmul
  from torch.fx.passes.shape_prop import ShapeProp
  from torch.testing._internal.common_utils import run_tests, TestCase
label_desc: Use image node_id 3 for calling the TestFxFusion obj's underlying member method code with example usage: obj.test_permute_linear_fusion() and returns: torch, torch