code: def ref_inq_convolution(
      x,
      w,
      i,
      b,
      base_axis,
      pad,
      stride,
      dilation,
      group,
      num_bits,
      inq_iterations,
      selection_algorithm,
      seed,
  ):
      if inq_iterations[-1] == 0:
          # last element in `inq_iterations`, quantize all weights
          i = np.ones_like(i)
      elif 0 in inq_iterations:
          # only `largest_abs` is deterministic and currently tested
          assert selection_algorithm == "largest_abs"
          idx_var = np.flatnonzero(i == 0)
          idx_newfix = idx_var[
              np.argsort(np.abs(w.ravel()[idx_var]))[
                  -(len(idx_var) // 2) :
              ]
          ]
          i.ravel()[idx_newfix] = 1
  
      wq = np.copy(w)
      if np.any(i == 1):
          wq[i == 1] = quantize(w[i == 1], np.max(np.abs(w)), num_bits)
  
      y = []
      for xx in x.reshape((-1,) + x.shape[base_axis:]):
          y += [
              refs.convolution_2d(
                  xx, wq, b, pad, stride, dilation, group
              )[np.newaxis]
          ]
      y = np.vstack(y)
      return y.reshape(x.shape[:base_axis] + y.shape[1:])
  
file_path: nnabla/python/test/function/test_inq_convolution.py
imports: from __future__ import division
  import pytest
  import numpy
  import nnabla
  import nnabla.functions
  import refs
  from nbla_test_utils import list_context
label_desc: Use image node_id 2 for calling a global function with example usage: ref_inq_convolution(x, w, i, b, base_axis, pad, stride, dilation, group, num_bits, inq_iterations, selection_algorithm, seed) and returns: y