code: def ref_grad_binary_weight_convolution(
      x,
      w,
      wb,
      alpha,
      b,
      dy,
      base_axis,
      pad,
      stride,
      dilation,
      group,
      quantize_zero_to,
      **kw,
  ):
      # Set variables
      vx = nn.Variable(x.shape, need_grad=True)
      vx.d = x
      vx.grad.zero()
      vw = nn.Variable(w.shape, need_grad=True)
      vw.d = binarize_kernel(w, quantize_zero_to)
      vw.grad.zero()
      vb = None
      if b is not None:
          vb = nn.Variable(b.shape, need_grad=True)
          vb.d = b
          vb.grad.zero()
  
      # Execute binarized forward and back prop.
      with nn.auto_forward():
          vy = F.convolution(
              vx, vw, vb, base_axis, pad, stride, dilation, group
          )
      vy.backward(dy)
  
      # Return grads
      if b is None:
          return np.concatenate([vx.g.flat, vw.g.flat])
      return np.concatenate([vx.g.flat, vw.g.flat, vb.g.flat])
  
file_path: nnabla/python/test/function/test_binary_weight_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 4 for calling a global function with example usage: ref_grad_binary_weight_convolution(x, w, wb, alpha, b, dy, base_axis, pad, stride, dilation, group, quantize_zero_to) and returns: np, np