code: def ref_grad_binary_connect_affine(
      x, w, wb, b, dy, base_axis, quantize_zero_to, **kw
  ):
      shape = list(x.shape[:base_axis])
  
      x_ = x.reshape(np.prod(shape), -1)
      wb_ = binarize(w, quantize_zero_to).reshape(w.shape[0], -1)
      dy_ = dy.reshape(np.prod(shape), -1)
  
      dx = np.dot(dy_, np.transpose(wb_))
      dw = np.dot(np.transpose(x_), dy_)
  
      if b is not None:
          db = np.sum(dy_, 0)
      else:
          db = np.empty(0)
  
      return np.concatenate([dx.flatten(), dw.flatten(), db.flatten()])
  
file_path: nnabla/python/test/function/test_binary_connect_affine.py
imports: import pytest
  import numpy
  import nnabla.functions
  from nbla_test_utils import list_context
label_desc: Use image node_id 3 for calling a global function with example usage: ref_grad_binary_connect_affine(x, w, wb, b, dy, base_axis, quantize_zero_to) and returns: np