class_docstr: Convert ``linear + add/sub`` to a single ``linear`` by updating the weight and bias of the ``linear`` layer.
  
  .. code-block::
  
      Example 1:
          Original:
              %4 = linear(x=%1, weight=%2, bias=%3) # %2 is a rank-2 const tensor (weight)
                                                    # %3 is a rank-1 const tensor (bias)
              ...
              %6 = add(x=%4, y=%5) # %5 is a const tensor with same shape as %3
  
          Result:
              %8 = linear(x=%1, weight=%2, bias=%7) # where %7 is a new const tensor with value
                                                    # %7 = %3 + %6
  
      Example 2:
          Original:
              %4 = linear(x=%1, weight=%2, bias=%3) # %2 is a rank-2 const tensor (weight)
                                                    # %3 is a rank-1 const tensor (bias)
              ...
              %6 = sub(x=%5, y=%4) # %5 is a const tensor with a broacasable shape with %3.
                                     i.e. if %3 has shape (Dout), %5 could be (1, Dout).
  
          Result:
              %9 = linear(x=%1, weight=%7, bias=%8) # where %7 is a new const tensor with value %7 = -%2
                                                    # %8 = %5 - %3
class_docstr_tok: ["Convert","``","linear","+","add\/sub","``","to","a","single","``","linear","``","by","updating","the","weight","and","bias","of","the","``","linear","``","layer",".","..","code-block",":",":","Example","1",":","Original",":","%","4","=","linear","(","x=","%","1",",","weight=","%","2",",","bias=","%","3",")","#","%","2","is","a","rank-2","const","tensor","(","weight",")","#","%","3","is","a","rank-1","const","tensor","(","bias",")","...","%","6","=","add","(","x=","%","4",",","y=","%","5",")","#","%","5","is","a","const","tensor","with","same","shape","as","%","3","Result",":","%","8","=","linear","(","x=","%","1",",","weight=","%","2",",","bias=","%","7",")","#","where","%","7","is","a","new","const","tensor","with","value","#","%","7","=","%","3","+","%","6","Example","2",":","Original",":","%","4","=","linear","(","x=","%","1",",","weight=","%","2",",","bias=","%","3",")","#","%","2","is","a","rank-2","const","tensor","(","weight",")","#","%","3","is","a","rank-1","const","tensor","(","bias",")","...","%","6","=","sub","(","x=","%","5",",","y=","%","4",")","#","%","5","is","a","const","tensor","with","a","broacasable","shape","with","%","3",".","i.e",".","if","%","3","has","shape","(","Dout",")",",","%","5","could","be","(","1",",","Dout",")",".","Result",":","%","9","=","linear","(","x=","%","1",",","weight=","%","7",",","bias=","%","8",")","#","where","%","7","is","a","new","const","tensor","with","value","%","7","=","-","%","2","#","%","8","=","%","5","-","%","3"]
code: def apply(self, prog: Program):
      for f in prog.functions.values():
          block_changed = True
          while block_changed:
              block_changed = self._fuse_linear_bias_block(f)
  
file_path: coremltools/coremltools/converters/mil/mil/passes/defs/optimize_linear.py
imports: import numpy
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Program
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.helper import block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
label_desc: Use image node_id 1 for calling the fuse_linear_bias obj's underlying member method code with example usage: obj.apply(prog) without return types