class_docstr: Transformation that fuses the bias to the weight in torch.nn.Linear.
class_docstr_tok: ["Transformation","that","fuses","the","bias","to","the","weight","in","torch.nn.Linear","."]
code: def transform(self, graph_module: "GraphModule") -> "GraphModule":
      torch_ones = _gen_constructor_wrapper(torch.ones)[0]
  
      def insert_concat(linear_input):
          shape = linear_input.shape[:-1] + (1,)
          return torch.cat(
              [
                  linear_input,
                  torch_ones(shape, device=linear_input.device),
              ],
              dim=-1,
          )
  
      tracer = torch.fx.proxy.GraphAppendingTracer(graph_module.graph)
      for node in graph_module.graph.nodes:
          if node.op == "call_module":
              module = graph_module.get_submodule(node.target)
              if (
                  isinstance(module, torch.nn.Linear)
                  and module.bias is not None
              ):
                  with graph_module.graph.inserting_before(node):
                      n = node.args[0]
                      node.nodes_to_ignore = set()
                      while n is not node:
                          node.nodes_to_ignore.add(n)
                          n = n.next
                      linear_input_proxy = torch.fx.Proxy(
                          node.args[0], tracer
                      )
                      output_proxy = insert_concat(linear_input_proxy)
                      node.start_node = linear_input_proxy.node
                      node.end_node = output_proxy.node
                      node.args = (output_proxy.node,)
                      self.mark_as_transformed(node)
                  new_weight = torch.nn.Parameter(
                      torch.cat(
                          [module.weight, module.bias[:, None]], dim=1
                      )
                  )
                  module.weight = new_weight
                  module.bias = None
      return graph_module
  
imports: import collections
  import copy
  import functools
  import itertools
  import operator
  import warnings
  from abc import ABC, abstractmethod
  from typing import TYPE_CHECKING, List
  import torch
  from transformers.file_utils import add_end_docstrings
  from transformers.utils.fx import _gen_constructor_wrapper
label_desc: Use image node_id 1 for calling the FuseBiasInLinear obj's underlying member method code with example usage: obj.transform(graph_module) and returns: graph_module, torch