class_docstr: ConvNet implementation.
docstr: Creates ConvNet instance.
  
  Args:
      nin: number of channels in the input image.
      nclass: number of output classes.
      scales: number of pooling layers, each of which reduces spatial dimension by 2.
      filters: base number of convolution filters.
               Number of convolution filters is increased by 2 every scale until it reaches filters_max.
      filters_max: maximum number of filters.
      pooling: type of pooling layer.
docstr_tok: ["Creates","ConvNet","instance",".","Args",":","nin",":","number","of","channels","in","the","input","image",".","nclass",":","number","of","output","classes",".","scales",":","number","of","pooling","layers",",","each","of","which","reduces","spatial","dimension","by","2.","filters",":","base","number","of","convolution","filters",".","Number","of","convolution","filters","is","increased","by","2","every","scale","until","it","reaches","filters_max",".","filters_max",":","maximum","number","of","filters",".","pooling",":","type","of","pooling","layer","."]
code: def __init__(
      self,
      nin,
      nclass,
      scales,
      filters,
      filters_max,
      pooling=objax.functional.max_pool_2d,
      **kwargs,
  ):
      """Creates ConvNet instance.
  
      Args:
          nin: number of channels in the input image.
          nclass: number of output classes.
          scales: number of pooling layers, each of which reduces spatial dimension by 2.
          filters: base number of convolution filters.
                   Number of convolution filters is increased by 2 every scale until it reaches filters_max.
          filters_max: maximum number of filters.
          pooling: type of pooling layer.
      """
      del kwargs
  
      def nf(scale):
          return min(filters_max, filters << scale)
  
      ops = [
          objax.nn.Conv2D(nin, nf(0), 3),
          objax.functional.leaky_relu,
      ]
      for i in range(scales):
          ops.extend(
              [
                  objax.nn.Conv2D(nf(i), nf(i), 3),
                  objax.functional.leaky_relu,
                  objax.nn.Conv2D(nf(i), nf(i + 1), 3),
                  objax.functional.leaky_relu,
                  functools.partial(pooling, size=2, strides=2),
              ]
          )
      ops.extend(
          [objax.nn.Conv2D(nf(scales), nclass, 3), self._mean_reduce]
      )
      super().__init__(ops)
  
imports: import functools
  import objax
  from objax.typing import JaxArray
label_desc: Use image node_id 2 to create a new ConvNet object from inherited base classes: objax.nn with example: obj = ConvNet(nin, nclass, scales, filters, filters_max, pooling)