code: def compute_expected_quantization(
      arr, curr_residual, threshold, quantize_func
  ):
      from struct import pack, unpack
  
      def as_float32(s):
          return unpack("f", pack("I", int(s, 2)))[0]
  
      arr_npy = arr.asnumpy()
      # str_quant stores the quantized representation as a sequence of bits
      str_quant, new_residual, decompr = quantize_func(
          arr_npy, curr_residual, threshold
      )
  
      compr = []
      # converts the string generated into integers 32chars at a time
      for i in range(0, len(str_quant), 32):
          cur_float = (
              str_quant[i + 24 : i + 32]
              + str_quant[i + 16 : i + 24]
              + str_quant[i + 8 : i + 16]
              + str_quant[i : i + 8]
          )
          compr.append(as_float32(cur_float))
  
      return (
          np.array(compr),
          np.array(new_residual).reshape(arr.shape),
          np.array(decompr).reshape(arr.shape),
      )
  
file_path: mxnet/tests/nightly/test_kvstore.py
imports: import sys
  import mxnet
  import numpy
  import numpy.random
  import copy
  from mxnet.test_utils import assert_almost_equal
label_desc: Use image node_id 4 for calling a global function with example usage: compute_expected_quantization(arr, curr_residual, threshold, quantize_func) and returns: np,  np,  np, unpack