class_docstr: The :class:`DorefaConv2d` class is a 2D quantized convolutional layer, which weights are 'bitW' bits and the output of the previous layer
  are 'bitA' bits while inferencing.
  
  Note that, the bias vector would not be binarized.
  
  Parameters
  ----------
  bitW : int
      The bits of this layer's parameter
  bitA : int
      The bits of the output of previous layer
  n_filter : int
      The number of filters.
  filter_size : tuple of int
      The filter size (height, width).
  strides : tuple of int
      The sliding window strides of corresponding input dimensions.
      It must be in the same order as the ``shape`` parameter.
  act : activation function
      The activation function of this layer.
  padding : str
      The padding algorithm type: "SAME" or "VALID".
  use_gemm : boolean
      If True, use gemm instead of ``tf.matmul`` for inferencing.
      TODO: support gemm
  data_format : str
      "channels_last" (NHWC, default) or "channels_first" (NCHW).
  dilation_rate : tuple of int
      Specifying the dilation rate to use for dilated convolution.
  W_init : initializer
      The initializer for the the weight matrix.
  b_init : initializer or None
      The initializer for the the bias vector. If None, skip biases.
  in_channels : int
      The number of in channels.
  name : None or str
      A unique layer name.
  
  Examples
  ---------
  With TensorLayer
  
  >>> net = tl.layers.Input([8, 12, 12, 32], name='input')
  >>> dorefaconv2d = tl.layers.QuanConv2d(
  ...     n_filter=32, filter_size=(5, 5), strides=(1, 1), act=tf.nn.relu, padding='SAME', name='dorefaconv2d'
  ... )(net)
  >>> print(dorefaconv2d)
  >>> output shape : (8, 12, 12, 32)
code: def forward(self, inputs):
      inputs = quantize_active(cabs(inputs), self.bitA)  # Do not remove
  
      W_ = quantize_weight(self.W, self.bitW)
  
      outputs = tf.nn.conv2d(
          input=inputs,
          filters=W_,
          strides=self._strides,
          padding=self.padding,
          data_format=self.data_format,
          dilations=self._dilation_rate,
          name=self.name,
      )
  
      if self.b_init:
          outputs = tf.nn.bias_add(
              outputs,
              self.b,
              data_format=self.data_format,
              name="bias_add",
          )
      if self.act:
          outputs = self.act(outputs)
  
      return outputs
  
file_path: TensorLayer/tensorlayer/layers/convolution/dorefa_conv.py
imports: import tensorflow
  import tensorlayer
  from tensorlayer import logging
  from tensorlayer.decorators import deprecated_alias
  from tensorlayer.layers.core import Layer
  from tensorlayer.layers.utils import cabs, quantize_active, quantize_weight
label_desc: Use image node_id 4 for calling the DorefaConv2d obj's underlying member method code with example usage: obj.forward(inputs) and returns: outputs