class_docstr: A LinearBn1d module is a module fused from Linear and BatchNorm1d, attached
  with FakeQuantize modules for weight, used in quantization aware training.
  
  We combined the interface of :class:`torch.nn.Linear` and
  :class:torch.nn.BatchNorm1d`.
  
  Similar to :class:`torch.nn.Linear`, with FakeQuantize modules initialized
  to default.
  
  Attributes:
      freeze_bn:
      weight_fake_quant: fake quant module for weight
class_docstr_tok: ["A","LinearBn1d","module","is","a","module","fused","from","Linear","and","BatchNorm1d",",","attached","with","FakeQuantize","modules","for","weight",",","used","in","quantization","aware","training",".","We","combined","the","interface","of",":","class",":","`","torch.nn.Linear","`","and",":","class",":","torch.nn.BatchNorm1d","`",".","Similar","to",":","class",":","`","torch.nn.Linear","`",",","with","FakeQuantize","modules","initialized","to","default",".","Attributes",":","freeze_bn",":","weight_fake_quant",":","fake","quant","module","for","weight"]
code: def forward(self, input):
      assert self.bn.running_var is not None
  
      # Scale the linear weights by BN's running statistics to reduce
      # weight jitter, see https://arxiv.org/pdf/1806.08342.pdf, page 18
      # for motivation.
      #
      # Instead of
      #
      #   x1 = F.linear(x0, fq(w), b)
      #   x2 = self.bn(x1)
      #
      # We have
      #
      #   # scale the weight by previous batch's running statistics
      #   scale_factor = bn.w / bn.running_std_from_prev_batch
      #   # do the linear transformation without bias
      #   x1_scaled = F.linear(x0, fq(w * scale_factor), 0)
      #   # reverse the scaling and add original bias
      #   x1_orig = x1_scaled / scale_factor + b
      #   x2 = self.bn(x1_orig)
  
      running_std = torch.sqrt(self.bn.running_var + self.bn.eps)
      scale_factor = self.bn.weight / running_std
      weight_shape = [1] * len(self.weight.shape)
      weight_shape[0] = -1
      bias_shape = [1] * len(self.weight.shape)
      bias_shape[1] = -1
      scaled_weight = self.weight_fake_quant(
          self.weight * scale_factor.reshape(weight_shape)
      )
      if self.bias is not None:
          zero_bias = torch.zeros_like(self.bias)
      else:
          zero_bias = torch.zeros(
              self.out_features, device=scaled_weight.device
          )
      linear_out = F.linear(input, scaled_weight, zero_bias)
      linear_out_orig = linear_out / scale_factor.reshape(bias_shape)
      if self.bias is not None:
          linear_out_orig = linear_out_orig + self.bias.reshape(
              bias_shape
          )
      bn_out = self.bn(linear_out_orig)
      return bn_out
  
file_path: pytorch/torch/ao/nn/intrinsic/qat/modules/linear_fused.py
imports: import torch
  import torch.nn
  import torch.ao.nn.intrinsic
  import torch.nn.functional
  from torch.nn import init
  from torch.nn.parameter import Parameter
  from torch.nn.utils.fusion import fuse_linear_bn_weights
label_desc: Use image node_id 7 for calling the LinearBn1d obj's underlying member method code with example usage: obj.forward(input) and returns: bn_out