code: def backward(ctx, grad_output):
      x, weight, bias = ctx.saved_tensors
      args = ctx.args
      stochastic = False
      grad_input = grad_weight = grad_bias = None
      if bias is not None and ctx.needs_input_grad[2]:
          grad_bias = grad_output.sum(0)
  
      # weight and x are already 8bit
      # -> transform grad_output to 8-bit
      if args.use_8bit_training == "forward+wgrad":
          grad_output8, S1 = LinearFunction.quant(
              grad_output, args.quant_type, dim=[0, 1]
          )
          x8, S2 = LinearFunction.quant(x, args.quant_type, dim=[0, 1])
          grad_weight8 = bnb.functional.igemm(grad_output8, x8)
          grad_weight = LinearFunction.dequant(
              grad_weight8, S1, S2, grad_output.dtype, args.quant_type
          )
  
          # grad_weight32 = torch.einsum('bso,bsi->oi', grad_output, x)
  
          grad_input = grad_output.matmul(weight)
      elif args.use_8bit_training == "full":
          grad_output8, S1 = LinearFunction.quant(
              grad_output, args.quant_type, dim=[0, 1]
          )
          x8, S2 = LinearFunction.quant(x, args.quant_type, dim=[0, 1])
          grad_weight8 = torch.zeros_like(weight, dtype=torch.int32)
          bnb.functional.igemm(grad_output8, x8, out=grad_weight8)
          grad_weight = LinearFunction.dequant(
              grad_weight8, S1, S2, grad_output.dtype, args.quant_type
          )
  
          grad_output8, S1 = LinearFunction.quant(
              grad_output, args.quant_type, dim=2
          )
          weight8, S3 = LinearFunction.quant(
              weight, args.quant_type, dim=0
          )
          grad_input8 = bnb.functional.igemm(grad_output8, weight8)
          grad_input = LinearFunction.dequant(
              grad_input8, S1, S3, grad_output.dtype, args.quant_type
          )
  
      else:
          grad_input = grad_output.matmul(weight)
          grad_weight = torch.einsum("bsi,bso->oi", x, grad_output)
  
      return grad_input, grad_weight, grad_bias, None
  
imports: from itertools import product
  import pytest
  import torch
  from torch import nn
  import bitsandbytes
label_desc: Use image node_id 13 for calling the LinearFunction obj's underlying member method code with example usage: obj.backward(ctx, grad_output) and returns: grad_input,  grad_weight,  grad_bias,  None