code: def fast_dequantize(W, quant_state=None, out=None):
      if quant_state is None:
          return W
      if type(quant_state) is not list:
          # New quant_state as a class
          # https://github.com/TimDettmers/bitsandbytes/pull/763/files
          absmax = quant_state.absmax
          shape = quant_state.shape
          dtype = quant_state.dtype
          blocksize = quant_state.blocksize
          offset = quant_state.offset
          state2 = quant_state.state2
          absmax2 = state2.absmax
          code2 = state2.code
          blocksize2 = state2.blocksize
      else:
          # Old quant_state as a list of lists
          (
              absmax,
              shape,
              dtype,
              blocksize,
              compressed_stats,
              _,
              _,
          ) = quant_state
          offset, state2 = compressed_stats
          absmax2, code2, blocksize2, _, _, _, _ = state2
      pass
  
      # Create weight matrix
      if out is None:
          out = torch.empty(shape, dtype=dtype, device="cuda")
      else:
          assert out.shape == shape
          assert out.dtype == dtype
  
      # NF4 dequantization of statistics
      n_elements_absmax = absmax.numel()
      out_absmax = torch.empty(
          n_elements_absmax, dtype=torch.float32, device="cuda"
      )
  
      # Do dequantization
      ptr_out_absmax = get_ptr(out_absmax)
      cdequantize_blockwise_fp32(
          get_ptr(code2),
          get_ptr(absmax),
          get_ptr(absmax2),
          ptr_out_absmax,
          ctypes.c_int(blocksize2),
          ctypes.c_int(n_elements_absmax),
      )
      out_absmax += offset
  
      fx = (
          cdequantize_blockwise_fp16_nf4
          if dtype == torch.float16
          else cdequantize_blockwise_bf16_nf4
      )
      fx(
          get_ptr(None),
          get_ptr(W),
          ptr_out_absmax,
          get_ptr(out),
          ctypes.c_int(blocksize),
          ctypes.c_int(out.numel()),
      )
  
      # Careful returning transposed data
      is_transposed = True if W.shape[0] == 1 else False
      return out.t() if is_transposed else out
  
imports: import triton
  import bitsandbytes
  import ctypes
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: fast_dequantize(W, quant_state, out) and returns: unknown, W