class_docstr: Separable/Depthwise Convolutional 2D layer, see `tf.nn.depthwise_conv2d <https://tensorflow.google.cn/versions/r2.0/api_docs/python/tf/nn/depthwise_conv2d>`__.
  
  Input:
      4-D Tensor (batch, height, width, in_channels).
  Output:
      4-D Tensor (batch, new height, new width, in_channels * depth_multiplier).
  
  Parameters
  ------------
  filter_size : tuple of 2 int
      The filter size (height, width).
  strides : tuple of 2 int
      The stride step (height, width).
  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 2 int
      The dilation rate in which we sample input values across the height and width dimensions in atrous convolution. If it is greater than 1, then all values of strides must be 1.
  depth_multiplier : int
      The number of channels to expand to.
  W_init : initializer
      The initializer for the weight matrix.
  b_init : initializer or None
      The initializer for the bias vector. If None, skip bias.
  in_channels : int
      The number of in channels.
  name : str
      A unique layer name.
  
  Examples
  ---------
  With TensorLayer
  
  >>> net = tl.layers.Input([8, 200, 200, 32], name='input')
  >>> depthwiseconv2d = tl.layers.DepthwiseConv2d(
  ...     filter_size=(3, 3), strides=(1, 1), dilation_rate=(2, 2), act=tf.nn.relu, depth_multiplier=2, name='depthwise'
  ... )(net)
  >>> print(depthwiseconv2d)
  >>> output shape : (8, 200, 200, 64)
  
  
  References
  -----------
  - tflearn's `grouped_conv_2d <https://github.com/tflearn/tflearn/blob/3e0c3298ff508394f3ef191bcd7d732eb8860b2e/tflearn/layers/conv.py>`__
  - keras's `separableconv2d <https://keras.io/layers/convolutional/#separableconv2d>`__
class_docstr_tok: ["Separable\/Depthwise","Convolutional","2D","layer",",","see","`","tf.nn.depthwise_conv2d","<","https",":","\/\/tensorflow.google.cn\/versions\/r2.0\/api_docs\/python\/tf\/nn\/depthwise_conv2d",">","`","__",".","Input",":","4-D","Tensor","(","batch",",","height",",","width",",","in_channels",")",".","Output",":","4-D","Tensor","(","batch",",","new","height",",","new","width",",","in_channels","*","depth_multiplier",")",".","Parameters","--","--","--","--","--","--","filter_size",":","tuple","of","2","int","The","filter","size","(","height",",","width",")",".","strides",":","tuple","of","2","int","The","stride","step","(","height",",","width",")",".","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","2","int","The","dilation","rate","in","which","we","sample","input","values","across","the","height","and","width","dimensions","in","atrous","convolution",".","If","it","is","greater","than","1",",","then","all","values","of","strides","must","be","1.","depth_multiplier",":","int","The","number","of","channels","to","expand","to",".","W_init",":","initializer","The","initializer","for","the","weight","matrix",".","b_init",":","initializer","or","None","The","initializer","for","the","bias","vector",".","If","None",",","skip","bias",".","in_channels",":","int","The","number","of","in","channels",".","name",":","str","A","unique","layer","name",".","Examples","--","--","--","--","-","With","TensorLayer",">",">",">","net","=","tl.layers.Input","(","[","8",",","200",",","200",",","32","]",",","name='input","'",")",">",">",">","depthwiseconv2d","=","tl.layers.DepthwiseConv2d","(","...","filter_size=","(","3",",","3",")",",","strides=","(","1",",","1",")",",","dilation_rate=","(","2",",","2",")",",","act=tf.nn.relu",",","depth_multiplier=2",",","name='depthwise'","...",")","(","net",")",">",">",">","print","(","depthwiseconv2d",")",">",">",">","output","shape",":","(","8",",","200",",","200",",","64",")","References","--","--","--","--","--","-","-","tflearn","'s","`","grouped_conv_2d","<","https",":","\/\/github.com\/tflearn\/tflearn\/blob\/3e0c3298ff508394f3ef191bcd7d732eb8860b2e\/tflearn\/layers\/conv.py",">","`","__","-","keras","'s","`","separableconv2d","<","https",":","\/\/keras.io\/layers\/convolutional\/","#","separableconv2d",">","`","__"]
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.filter_shape = (
          self.filter_size[0],
          self.filter_size[1],
          self.in_channels,
          self.depth_multiplier,
      )
  
      self.W = self._get_weights(
          "filters", shape=self.filter_shape, init=self.W_init
      )
  
      if self.b_init:
          self.b = self._get_weights(
              "biases",
              shape=(self.in_channels * self.depth_multiplier),
              init=self.b_init,
          )
  
file_path: TensorLayer/tensorlayer/layers/convolution/depthwise_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 DepthwiseConv2d obj's underlying member method code with example usage: obj.build(inputs_shape) without return types