code: def ref_grad_pow2_quantize(
      x, dy, sign, with_zero, n, m, quantize, ste_fine_grained, **kw
  ):
      if not ste_fine_grained:
          return dy.flatten()
  
      n_ = n - 1 if sign else n
      n_ = n_ - 1 if with_zero else n_
      ref_p_max = 2**m
      ref_p_min = 2 ** (m - ((1 << n_) - 1))
      ref_pruning_threshold = ref_p_min * (2.0**-0.5)
      x_q = 2.0 ** np.round(np.log2(np.abs(x)))
      c = np.ones_like(x)
      c[np.where(x_q > ref_p_max)] = 0.0
  
      if not sign:
          c[np.where(np.sign(x) < 0.0)] = 0.0
  
      return (c * dy).flatten()
  
file_path: nnabla/python/test/function/test_pow2_quantize.py
imports: import pytest
  import numpy
  import nnabla
  import nnabla.functions
  from nbla_test_utils import list_context
label_desc: Use image node_id 2 for calling a global function with example usage: ref_grad_pow2_quantize(x, dy, sign, with_zero, n, m, quantize, ste_fine_grained) and returns: unknown, dy