class_docstr: 2-dimensional pooling layer (local pooling) (specification key: `pool2d`).
  
  Args:
      reduction ('average' | 'max'): Pooling type
          (<span style="color:#C00000"><b>required</b></span>).
      window (int > 0 | (int > 0, int > 0)): Window size
          (<span style="color:#00C000"><b>default</b></span>: 2).
      stride (int > 0 | (int > 0, int > 0)): Stride size
          (<span style="color:#00C000"><b>default</b></span>: 2).
      padding ('same' | 'valid'): Padding type, see
          `TensorFlow docs <https://www.tensorflow.org/api_docs/python/tf/nn/convolution>`__
          (<span style="color:#00C000"><b>default</b></span>: 'same').
      name (string): Layer name
          (<span style="color:#00C000"><b>default</b></span>: internally chosen).
      input_spec (specification): <span style="color:#00C000"><b>internal use</b></span>.
class_docstr_tok: ["2-dimensional","pooling","layer","(","local","pooling",")","(","specification","key",":","`","pool2d","`",")",".","Args",":","reduction","(","'average","'","|","'max","'",")",":","Pooling","type","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","window","(","int",">","0","|","(","int",">","0",",","int",">","0",")",")",":","Window","size","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","2",")",".","stride","(","int",">","0","|","(","int",">","0",",","int",">","0",")",")",":","Stride","size","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","2",")",".","padding","(","'same","'","|","'valid","'",")",":","Padding","type",",","see","`","TensorFlow","docs","<","https",":","\/\/www.tensorflow.org\/api_docs\/python\/tf\/nn\/convolution",">","`","__","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","'same","'",")",".","name","(","string",")",":","Layer","name","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","internally","chosen",")",".","input_spec","(","specification",")",":","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">","."]
code: def __init__(
      self,
      *,
      reduction,
      window=2,
      stride=2,
      padding="same",
      name=None,
      input_spec=None,
  ):
      if reduction not in ("average", "max"):
          raise TensorforceError.value(
              name="pool1d", argument="reduction", value=reduction
          )
      self.reduction = reduction
  
      if isinstance(window, int):
          self.window = (1, window, window, 1)
      elif len(window) == 2:
          self.window = (1, window[0], window[1], 1)
      else:
          raise TensorforceError.type(
              name="Pool2d", argument="window", dtype=type(window)
          )
  
      if isinstance(stride, int):
          self.stride = (1, stride, stride, 1)
      elif len(window) == 2:
          self.stride = (1, stride[0], stride[1], 1)
      else:
          raise TensorforceError.type(
              name="Pool2d", argument="stride", dtype=type(stride)
          )
  
      self.padding = padding
  
      super().__init__(name=name, input_spec=input_spec)
  
      self.architecture_kwargs["reduction"] = reduction
      self.architecture_kwargs["window"] = str(window)
      self.architecture_kwargs["stride"] = str(stride)
      self.architecture_kwargs["padding"] = padding
  
imports: import numpy
  import tensorflow
  from tensorforce import TensorforceError
  from tensorforce.core import TensorSpec, tf_function, tf_util
  from tensorforce.core.layers import Layer
label_desc: Use image node_id 1 to create a new Pool2d object from inherited base classes: Layer with example: obj = Pool2d()