code: def binary_connect_affine(
      inp,
      n_outmaps,
      base_axis=1,
      quantize_zero_to=1.0,
      w_init=None,
      wb_init=None,
      b_init=None,
      fix_parameters=False,
      rng=None,
      with_bias=True,
  ):
      """Binary Connect Affine, multiplier-less inner-product.
  
      Binary Connect Affine is an affine function,
      except the definition of the inner product is modified.
      The input-output relation of this function is as follows:
  
      .. math::
  
          y_i = \sum_{i} sign(w_i) x_i.
  
      Therefore :math:`sign(w_i)` is either :math:`1` or :math:`-1` and the inner product
      simplifies to addition.
  
      This function should be used together with Batch Normalization.
  
      References:
  
          M. Courbariaux, Y. Bengio, and J.-P. David. "BinaryConnect:
          Training Deep Neural Networks with binary weights during propagations."
          Advances in Neural Information Processing Systems. 2015.
  
      .. note::
  
          1) if you would like to share weights between some layers, please
          make sure to share the standard, floating value weights (`weight`)
          and not the binarized weights (`binary_weight`)
  
          2) The weights and the binary weights become synced only after :func:`~nnabla._variable.Variable.forward` is called,
          and not after a call to :func:`~nnabla._variable.Variable.backward`.
          To access the parameters of the network, remember to call :func:`~nnabla._variable.Variable.forward` once before doing so, otherwise the
          float weights and the binary weights will not be in sync.
  
          3) Quantized values are stored as floating point number for `binary_weight`,
          since this function is only for simulation purposes.
  
      Args:
          inp (~nnabla.Variable): Input N-D array with shape (:math:`M_0 \\times \ldots \\times M_{B-1} \\times D_B \\times \ldots \\times D_N`). Dimensions before and after base_axis are flattened as if it is a matrix.
          n_outmaps (int or :obj:`tuple` of :obj:`int`): Number of output neurons per data.
          base_axis (int): Dimensions up to `base_axis` are treated as the sample dimensions.
          quantize_zero_to (float): Input value at zero is quantized to this value.
          w_init (:obj:`nnabla.initializer.BaseInitializer` or :obj:`numpy.ndarray`): Initializer for weight. By default, it is initialized with :obj:`nnabla.initializer.UniformInitializer` within the range determined by :obj:`nnabla.initializer.calc_uniform_lim_glorot`.
          wb_init (:obj:`nnabla.initializer.BaseInitializer` or :obj:`numpy.ndarray`): Initializer for binary weight. By default, it is initialized with :obj:`nnabla.initializer.UniformInitializer` within the range determined by :obj:`nnabla.initializer.calc_uniform_lim_glorot`.
          b_init (:obj:`nnabla.initializer.BaseInitializer` or :obj:`numpy.ndarray`): Initializer for bias. By default, it is initialized with zeros if `with_bias` is `True`.
          fix_parameters (bool): When set to `True`, the weights and biases will not be updated.
          rng (numpy.random.RandomState): Random generator for Initializer.
  
      Returns:
          :class:`~nnabla.Variable`
  
      """
      if not hasattr(n_outmaps, "__iter__"):
          n_outmaps = [n_outmaps]
      n_outmaps = list(n_outmaps)
      n_outmap = int(np.prod(n_outmaps))
      if w_init is None:
          fan_in = np.prod(inp.shape[base_axis:])
          w_init = UniformInitializer(
              calc_uniform_lim_glorot(fan_in, n_outmap), rng=rng
          )
      if wb_init is None:
          fan_in = np.prod(inp.shape[base_axis:])
          wb_init = UniformInitializer(
              calc_uniform_lim_glorot(fan_in, n_outmap), rng=rng
          )
      if b_init is None:
          b_init = ConstantInitializer()
      w = get_parameter_or_create(
          "W",
          [int(np.prod(inp.shape[base_axis:]))] + n_outmaps,
          w_init,
          True,
          not fix_parameters,
      )
      wb = get_parameter_or_create(
          "Wb",
          [int(np.prod(inp.shape[base_axis:]))] + n_outmaps,
          wb_init,
          False,
      )
      b = None
      if with_bias:
          b = get_parameter_or_create(
              "b", n_outmaps, b_init, True, not fix_parameters
          )
      return F.binary_connect_affine(
          inp, w, wb, b, base_axis, quantize_zero_to
      )
  
imports: from six import exec_
  import numpy
  import nnabla
  import nnabla.functions
  from nnabla.parameter import get_parameter_or_create, get_parameter
  from nnabla.initializer import calc_uniform_lim_glorot, ConstantInitializer, NormalInitializer, UniformInitializer, WeightNormalizationScaleInitializer
label_desc: Use image node_id 4 for calling a global function with example usage: binary_connect_affine(inp, n_outmaps, base_axis, quantize_zero_to, w_init, wb_init, b_init, fix_parameters, rng, with_bias) and returns: F