class_docstr: The :class:`GroupConv2d` class is 2D grouped convolution, see `here <https://blog.yani.io/filter-group-tutorial/>`__.
  
  Parameters
  --------------
  n_filter : int
      The number of filters.
  filter_size : tuple of int
      The filter size.
  strides : tuple of int
      The stride step.
  n_group : int
      The number of groups.
  act : activation function
      The activation function of this layer.
  padding : str
      The padding algorithm type: "SAME" or "VALID".
  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 weight matrix.
  b_init : initializer or None
      The initializer for 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, 24, 24, 32], name='input')
  >>> groupconv2d = tl.layers.QuanConv2d(
  ...     n_filter=64, filter_size=(3, 3), strides=(2, 2), n_group=2, name='group'
  ... )(net)
  >>> print(groupconv2d)
  >>> output shape : (8, 12, 12, 64)
class_docstr_tok: ["The",":","class",":","`","GroupConv2d","`","class","is","2D","grouped","convolution",",","see","`","here","<","https",":","\/\/blog.yani.io\/filter-group-tutorial\/",">","`","__",".","Parameters","--","--","--","--","--","--","--","n_filter",":","int","The","number","of","filters",".","filter_size",":","tuple","of","int","The","filter","size",".","strides",":","tuple","of","int","The","stride","step",".","n_group",":","int","The","number","of","groups",".","act",":","activation","function","The","activation","function","of","this","layer",".","padding",":","str","The","padding","algorithm","type",":","``","SAME","''","or","``","VALID","''",".","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","weight","matrix",".","b_init",":","initializer","or","None","The","initializer","for","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",",","24",",","24",",","32","]",",","name='input","'",")",">",">",">","groupconv2d","=","tl.layers.QuanConv2d","(","...","n_filter=64",",","filter_size=","(","3",",","3",")",",","strides=","(","2",",","2",")",",","n_group=2",",","name='group'","...",")","(","net",")",">",">",">","print","(","groupconv2d",")",">",">",">","output","shape",":","(","8",",","12",",","12",",","64",")"]
code: def build(self, inputs_shape):
      if self.data_format == "channels_last":
          self.data_format = "NHWC"
          if self.in_channels is None:
              self.in_channels = inputs_shape[-1]
          self._strides = [1, self._strides[0], self._strides[1], 1]
          self._dilation_rate = [
              1,
              self._dilation_rate[0],
              self._dilation_rate[1],
              1,
          ]
      elif self.data_format == "channels_first":
          self.data_format = "NCHW"
          if self.in_channels is None:
              self.in_channels = inputs_shape[1]
          self._strides = [1, 1, self._strides[0], self._strides[1]]
          self._dilation_rate = [
              1,
              1,
              self._dilation_rate[0],
              self._dilation_rate[1],
          ]
      else:
          raise Exception(
              "data_format should be either channels_last or channels_first"
          )
  
      self.groupConv = lambda i, k: tf.nn.conv2d(
          i,
          k,
          strides=self._strides,
          padding=self.padding,
          data_format=self.data_format,
          dilations=self._dilation_rate,
          name=self.name,
      )
  
      self.filter_shape = (
          self.filter_size[0],
          self.filter_size[1],
          int(self.in_channels / self.n_group),
          self.n_filter,
      )
  
      self.We = self._get_weights(
          "filters", shape=self.filter_shape, init=self.W_init
      )
      if self.b_init:
          self.b = self._get_weights(
              "biases", shape=self.n_filter, init=self.b_init
          )
  
file_path: TensorLayer/tensorlayer/layers/convolution/group_conv.py
imports: import tensorflow
  import tensorlayer
  from tensorlayer import logging
  from tensorlayer.decorators import deprecated_alias
  from tensorlayer.layers.core import Layer
label_desc: Use image node_id 3 for calling the GroupConv2d obj's underlying member method code with example usage: obj.build(inputs_shape) without return types