B
    ӻd                 @   sD  d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ dd	lmZ dd
lmZ ddlmZ G dd deZeddG dd deZeddG dd deZG dd deZeddG dd deZeddG dd deZG d d! d!eZed"d#G d$d% d%eZed&d'G d(d) d)eZG d*d+ d+eZed,d-G d.d/ d/eZed0d1G d2d3 d3eZG d4d5 d5eZed6d7G d8d9 d9eZed:d;G d<d= d=eZ G d>d? d?eZ!ed@dAG dBdC dCe!Z"edDdEG dFdG dGe!Z#eZ$eZ%eZ&eZ'eZ(eZ)eZ*e Z+e#Z,eZ-eZ.e"Z/dS )HzPooling layers.    N)tensor_shape)backend)Layer)	InputSpec)
conv_utils)	array_ops)math_ops)nn)keras_exportc                   s>   e Zd ZdZd fdd	Zdd Zd	d
 Z fddZ  ZS )	Pooling1Da  Pooling layer for arbitrary pooling functions, for 1D inputs.

  This class only exists for code reuse. It will never be an exposed API.

  Args:
    pool_function: The pooling function to apply, e.g. `tf.nn.max_pool2d`.
    pool_size: An integer or tuple/list of a single integer,
      representing the size of the pooling window.
    strides: An integer or tuple/list of a single integer, specifying the
      strides of the pooling operation.
    padding: A string. The padding method, either 'valid' or 'same'.
      Case-insensitive.
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, steps, features)` while `channels_first`
      corresponds to inputs with shape
      `(batch, features, steps)`.
    name: A string, the name of the layer.
  validchannels_lastNc                s   t t| jf d|i| |d kr*t }|d kr6|}|| _t|dd| _t|dd| _	t
|| _t|| _tdd| _d S )Nname   	pool_sizestrides   )ndim)superr   __init__r   image_data_formatpool_functionr   normalize_tupler   r   normalize_paddingpaddingnormalize_data_formatdata_formatr   
input_spec)selfr   r   r   r   r   r   kwargs)	__class__ X/var/www/html/venv/lib/python3.7/site-packages/tensorflow/python/keras/layers/pooling.pyr   5   s    zPooling1D.__init__c             C   sN   | j dkrdnd}t||}| j|| jd | jd | j| j d}t||S )Nr      r   )r   )r   r   r   )r   r   expand_dimsr   r   r   r   Zsqueeze)r   inputsZpad_axisoutputsr!   r!   r"   callD   s    
zPooling1D.callc             C   s   t | }| jdkr*|d }|d }n|d }|d }t|| jd | j| jd }| jdkrvt |d ||gS t |d ||gS d S )Nchannels_firstr#   r   r   )	r   TensorShapeas_listr   r   conv_output_lengthr   r   r   )r   input_shapeZstepsfeatureslengthr!   r!   r"   compute_output_shapeO   s    


zPooling1D.compute_output_shapec                s@   | j | j| j| jd}tt|  }tt|	 t|	  S )N)r   r   r   r   )
r   r   r   r   r   r   
get_configdictlistitems)r   configbase_config)r    r!   r"   r0   `   s    
zPooling1D.get_config)r   r   N)	__name__
__module____qualname____doc__r   r'   r/   r0   __classcell__r!   r!   )r    r"   r      s    r   zkeras.layers.MaxPool1Dzkeras.layers.MaxPooling1Dc                   s"   e Zd ZdZd fdd	Z  ZS )	MaxPooling1Da%  Max pooling operation for 1D temporal data.

  Downsamples the input representation by taking the maximum value over a
  spatial window of size `pool_size`. The window is shifted by `strides`.  The
  resulting output, when using the `"valid"` padding option, has a shape of:
  `output_shape = (input_shape - pool_size + 1) / strides)`

  The resulting output shape when using the `"same"` padding option is:
  `output_shape = input_shape / strides`

  For example, for `strides=1` and `padding="valid"`:

  >>> x = tf.constant([1., 2., 3., 4., 5.])
  >>> x = tf.reshape(x, [1, 5, 1])
  >>> max_pool_1d = tf.keras.layers.MaxPooling1D(pool_size=2,
  ...    strides=1, padding='valid')
  >>> max_pool_1d(x)
  <tf.Tensor: shape=(1, 4, 1), dtype=float32, numpy=
  array([[[2.],
          [3.],
          [4.],
          [5.]]], dtype=float32)>

  For example, for `strides=2` and `padding="valid"`:

  >>> x = tf.constant([1., 2., 3., 4., 5.])
  >>> x = tf.reshape(x, [1, 5, 1])
  >>> max_pool_1d = tf.keras.layers.MaxPooling1D(pool_size=2,
  ...    strides=2, padding='valid')
  >>> max_pool_1d(x)
  <tf.Tensor: shape=(1, 2, 1), dtype=float32, numpy=
  array([[[2.],
          [4.]]], dtype=float32)>

  For example, for `strides=1` and `padding="same"`:

  >>> x = tf.constant([1., 2., 3., 4., 5.])
  >>> x = tf.reshape(x, [1, 5, 1])
  >>> max_pool_1d = tf.keras.layers.MaxPooling1D(pool_size=2,
  ...    strides=1, padding='same')
  >>> max_pool_1d(x)
  <tf.Tensor: shape=(1, 5, 1), dtype=float32, numpy=
  array([[[2.],
          [3.],
          [4.],
          [5.],
          [5.]]], dtype=float32)>

  Args:
    pool_size: Integer, size of the max pooling window.
    strides: Integer, or None. Specifies how much the pooling window moves
      for each pooling step.
      If None, it will default to `pool_size`.
    padding: One of `"valid"` or `"same"` (case-insensitive).
      `"valid"` means no padding. `"same"` results in padding evenly to
      the left/right or up/down of the input such that output has the same
      height/width dimension as the input.
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, steps, features)` while `channels_first`
      corresponds to inputs with shape
      `(batch, features, steps)`.

  Input shape:
    - If `data_format='channels_last'`:
      3D tensor with shape `(batch_size, steps, features)`.
    - If `data_format='channels_first'`:
      3D tensor with shape `(batch_size, features, steps)`.

  Output shape:
    - If `data_format='channels_last'`:
      3D tensor with shape `(batch_size, downsampled_steps, features)`.
    - If `data_format='channels_first'`:
      3D tensor with shape `(batch_size, features, downsampled_steps)`.
  r#   Nr   r   c                s2   t t| jtjtjddf||||d| d S )Nmax)	pool_mode)r   r   r   r   )r   r;   r   	functoolspartialr   pool2d)r   r   r   r   r   r   )r    r!   r"   r      s    
zMaxPooling1D.__init__)r#   Nr   r   )r6   r7   r8   r9   r   r:   r!   r!   )r    r"   r;   k   s   N r;   zkeras.layers.AveragePooling1Dzkeras.layers.AvgPool1Dc                   s"   e Zd ZdZd fdd	Z  ZS )	AveragePooling1Da  Average pooling for temporal data.

  Downsamples the input representation by taking the average value over the
  window defined by `pool_size`. The window is shifted by `strides`.  The
  resulting output when using "valid" padding option has a shape of:
  `output_shape = (input_shape - pool_size + 1) / strides)`

  The resulting output shape when using the "same" padding option is:
  `output_shape = input_shape / strides`

  For example, for strides=1 and padding="valid":

  >>> x = tf.constant([1., 2., 3., 4., 5.])
  >>> x = tf.reshape(x, [1, 5, 1])
  >>> x
  <tf.Tensor: shape=(1, 5, 1), dtype=float32, numpy=
    array([[[1.],
            [2.],
            [3.],
            [4.],
            [5.]], dtype=float32)>
  >>> avg_pool_1d = tf.keras.layers.AveragePooling1D(pool_size=2,
  ...    strides=1, padding='valid')
  >>> avg_pool_1d(x)
  <tf.Tensor: shape=(1, 4, 1), dtype=float32, numpy=
  array([[[1.5],
          [2.5],
          [3.5],
          [4.5]]], dtype=float32)>

  For example, for strides=2 and padding="valid":

  >>> x = tf.constant([1., 2., 3., 4., 5.])
  >>> x = tf.reshape(x, [1, 5, 1])
  >>> x
  <tf.Tensor: shape=(1, 5, 1), dtype=float32, numpy=
    array([[[1.],
            [2.],
            [3.],
            [4.],
            [5.]], dtype=float32)>
  >>> avg_pool_1d = tf.keras.layers.AveragePooling1D(pool_size=2,
  ...    strides=2, padding='valid')
  >>> avg_pool_1d(x)
  <tf.Tensor: shape=(1, 2, 1), dtype=float32, numpy=
  array([[[1.5],
          [3.5]]], dtype=float32)>

  For example, for strides=1 and padding="same":

  >>> x = tf.constant([1., 2., 3., 4., 5.])
  >>> x = tf.reshape(x, [1, 5, 1])
  >>> x
  <tf.Tensor: shape=(1, 5, 1), dtype=float32, numpy=
    array([[[1.],
            [2.],
            [3.],
            [4.],
            [5.]], dtype=float32)>
  >>> avg_pool_1d = tf.keras.layers.AveragePooling1D(pool_size=2,
  ...    strides=1, padding='same')
  >>> avg_pool_1d(x)
  <tf.Tensor: shape=(1, 5, 1), dtype=float32, numpy=
  array([[[1.5],
          [2.5],
          [3.5],
          [4.5],
          [5.]]], dtype=float32)>

  Args:
    pool_size: Integer, size of the average pooling windows.
    strides: Integer, or None. Factor by which to downscale.
      E.g. 2 will halve the input.
      If None, it will default to `pool_size`.
    padding: One of `"valid"` or `"same"` (case-insensitive).
      `"valid"` means no padding. `"same"` results in padding evenly to
      the left/right or up/down of the input such that output has the same
      height/width dimension as the input.
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, steps, features)` while `channels_first`
      corresponds to inputs with shape
      `(batch, features, steps)`.

  Input shape:
    - If `data_format='channels_last'`:
      3D tensor with shape `(batch_size, steps, features)`.
    - If `data_format='channels_first'`:
      3D tensor with shape `(batch_size, features, steps)`.

  Output shape:
    - If `data_format='channels_last'`:
      3D tensor with shape `(batch_size, downsampled_steps, features)`.
    - If `data_format='channels_first'`:
      3D tensor with shape `(batch_size, features, downsampled_steps)`.
  r#   Nr   r   c                s2   t t| jtjtjddf||||d| d S )Navg)r=   )r   r   r   r   )r   rA   r   r>   r?   r   r@   )r   r   r   r   r   r   )r    r!   r"   r   ,  s    
zAveragePooling1D.__init__)r#   Nr   r   )r6   r7   r8   r9   r   r:   r!   r!   )r    r"   rA      s   c rA   c                   s>   e Zd ZdZd fdd	Zdd Zdd	 Z fd
dZ  ZS )	Pooling2Da^  Pooling layer for arbitrary pooling functions, for 2D inputs (e.g. images).

  This class only exists for code reuse. It will never be an exposed API.

  Args:
    pool_function: The pooling function to apply, e.g. `tf.nn.max_pool2d`.
    pool_size: An integer or tuple/list of 2 integers: (pool_height, pool_width)
      specifying the size of the pooling window.
      Can be a single integer to specify the same value for
      all spatial dimensions.
    strides: An integer or tuple/list of 2 integers,
      specifying the strides of the pooling operation.
      Can be a single integer to specify the same value for
      all spatial dimensions.
    padding: A string. The padding method, either 'valid' or 'same'.
      Case-insensitive.
    data_format: A string, one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, height, width, channels)` while `channels_first` corresponds to
      inputs with shape `(batch, channels, height, width)`.
    name: A string, the name of the layer.
  r   Nc                s   t t| jf d|i| |d kr*t }|d kr6|}|| _t|dd| _t|dd| _	t
|| _t|| _tdd| _d S )Nr   r#   r   r      )r   )r   rC   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )r    r!   r"   r   P  s    zPooling2D.__init__c          	   C   sd   | j dkr(d| j d }d| j d }nd| j }d| j }| j|||| j t| j dd}|S )Nr   )r   )r   r   rD   )ksizer   r   r   )r   r   r   r   r   upperr   Zconvert_data_format)r   r%   
pool_shaper   r&   r!   r!   r"   r'   _  s    


zPooling2D.callc             C   s   t | }| jdkr*|d }|d }n|d }|d }t|| jd | j| jd }t|| jd | j| jd }| jdkrt |d |d ||gS t |d |||d gS d S )Nr(   r#   r   r   r   )	r   r)   r*   r   r   r+   r   r   r   )r   r,   rowscolsr!   r!   r"   r/   n  s    


zPooling2D.compute_output_shapec                s@   | j | j| j| jd}tt|  }tt|	 t|	  S )N)r   r   r   r   )
r   r   r   r   r   rC   r0   r1   r2   r3   )r   r4   r5   )r    r!   r"   r0     s    
zPooling2D.get_config)r   NN)	r6   r7   r8   r9   r   r'   r/   r0   r:   r!   r!   )r    r"   rC   7  s    rC   zkeras.layers.MaxPool2Dzkeras.layers.MaxPooling2Dc                   s"   e Zd ZdZd fdd	Z  ZS )MaxPooling2DaJ  Max pooling operation for 2D spatial data.

  Downsamples the input along its spatial dimensions (height and width)
  by taking the maximum value over an input window
  (of size defined by `pool_size`) for each channel of the input.
  The window is shifted by `strides` along each dimension.

  The resulting output,
  when using the `"valid"` padding option, has a spatial shape
  (number of rows or columns) of:
  `output_shape = math.floor((input_shape - pool_size) / strides) + 1`
  (when `input_shape >= pool_size`)

  The resulting output shape when using the `"same"` padding option is:
  `output_shape = math.floor((input_shape - 1) / strides) + 1`

  For example, for `strides=(1, 1)` and `padding="valid"`:

  >>> x = tf.constant([[1., 2., 3.],
  ...                  [4., 5., 6.],
  ...                  [7., 8., 9.]])
  >>> x = tf.reshape(x, [1, 3, 3, 1])
  >>> max_pool_2d = tf.keras.layers.MaxPooling2D(pool_size=(2, 2),
  ...    strides=(1, 1), padding='valid')
  >>> max_pool_2d(x)
  <tf.Tensor: shape=(1, 2, 2, 1), dtype=float32, numpy=
    array([[[[5.],
             [6.]],
            [[8.],
             [9.]]]], dtype=float32)>

  For example, for `strides=(2, 2)` and `padding="valid"`:

  >>> x = tf.constant([[1., 2., 3., 4.],
  ...                  [5., 6., 7., 8.],
  ...                  [9., 10., 11., 12.]])
  >>> x = tf.reshape(x, [1, 3, 4, 1])
  >>> max_pool_2d = tf.keras.layers.MaxPooling2D(pool_size=(2, 2),
  ...    strides=(2, 2), padding='valid')
  >>> max_pool_2d(x)
  <tf.Tensor: shape=(1, 1, 2, 1), dtype=float32, numpy=
    array([[[[6.],
             [8.]]]], dtype=float32)>

  Usage Example:

  >>> input_image = tf.constant([[[[1.], [1.], [2.], [4.]],
  ...                            [[2.], [2.], [3.], [2.]],
  ...                            [[4.], [1.], [1.], [1.]],
  ...                            [[2.], [2.], [1.], [4.]]]])
  >>> output = tf.constant([[[[1], [0]],
  ...                       [[0], [1]]]])
  >>> model = tf.keras.models.Sequential()
  >>> model.add(tf.keras.layers.MaxPooling2D(pool_size=(2, 2),
  ...    input_shape=(4, 4, 1)))
  >>> model.compile('adam', 'mean_squared_error')
  >>> model.predict(input_image, steps=1)
  array([[[[2.],
           [4.]],
          [[4.],
           [4.]]]], dtype=float32)

  For example, for stride=(1, 1) and padding="same":

  >>> x = tf.constant([[1., 2., 3.],
  ...                  [4., 5., 6.],
  ...                  [7., 8., 9.]])
  >>> x = tf.reshape(x, [1, 3, 3, 1])
  >>> max_pool_2d = tf.keras.layers.MaxPooling2D(pool_size=(2, 2),
  ...    strides=(1, 1), padding='same')
  >>> max_pool_2d(x)
  <tf.Tensor: shape=(1, 3, 3, 1), dtype=float32, numpy=
    array([[[[5.],
             [6.],
             [6.]],
            [[8.],
             [9.],
             [9.]],
            [[8.],
             [9.],
             [9.]]]], dtype=float32)>

  Args:
    pool_size: integer or tuple of 2 integers,
      window size over which to take the maximum.
      `(2, 2)` will take the max value over a 2x2 pooling window.
      If only one integer is specified, the same window length
      will be used for both dimensions.
    strides: Integer, tuple of 2 integers, or None.
      Strides values.  Specifies how far the pooling window moves
      for each pooling step. If None, it will default to `pool_size`.
    padding: One of `"valid"` or `"same"` (case-insensitive).
      `"valid"` means no padding. `"same"` results in padding evenly to
      the left/right or up/down of the input such that output has the same
      height/width dimension as the input.
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, height, width, channels)` while `channels_first`
      corresponds to inputs with shape
      `(batch, channels, height, width)`.
      It defaults to the `image_data_format` value found in your
      Keras config file at `~/.keras/keras.json`.
      If you never set it, then it will be "channels_last".

  Input shape:
    - If `data_format='channels_last'`:
      4D tensor with shape `(batch_size, rows, cols, channels)`.
    - If `data_format='channels_first'`:
      4D tensor with shape `(batch_size, channels, rows, cols)`.

  Output shape:
    - If `data_format='channels_last'`:
      4D tensor with shape `(batch_size, pooled_rows, pooled_cols, channels)`.
    - If `data_format='channels_first'`:
      4D tensor with shape `(batch_size, channels, pooled_rows, pooled_cols)`.

  Returns:
    A tensor of rank 4 representing the maximum pooled values.  See above for
    output shape.
  r#   r#   Nr   c                s(   t t| jtjf||||d| d S )N)r   r   r   r   )r   rJ   r   r	   Zmax_pool)r   r   r   r   r   r   )r    r!   r"   r   	  s    
zMaxPooling2D.__init__)rK   Nr   N)r6   r7   r8   r9   r   r:   r!   r!   )r    r"   rJ     s
   {   rJ   zkeras.layers.AveragePooling2Dzkeras.layers.AvgPool2Dc                   s"   e Zd ZdZd fdd	Z  ZS )AveragePooling2Da  Average pooling operation for spatial data.

  Downsamples the input along its spatial dimensions (height and width)
  by taking the average value over an input window
  (of size defined by `pool_size`) for each channel of the input.
  The window is shifted by `strides` along each dimension.

  The resulting output when using `"valid"` padding option has a shape
  (number of rows or columns) of:
  `output_shape = math.floor((input_shape - pool_size) / strides) + 1`
  (when `input_shape >= pool_size`)

  The resulting output shape when using the `"same"` padding option is:
  `output_shape = math.floor((input_shape - 1) / strides) + 1`

  For example, for `strides=(1, 1)` and `padding="valid"`:

  >>> x = tf.constant([[1., 2., 3.],
  ...                  [4., 5., 6.],
  ...                  [7., 8., 9.]])
  >>> x = tf.reshape(x, [1, 3, 3, 1])
  >>> avg_pool_2d = tf.keras.layers.AveragePooling2D(pool_size=(2, 2),
  ...    strides=(1, 1), padding='valid')
  >>> avg_pool_2d(x)
  <tf.Tensor: shape=(1, 2, 2, 1), dtype=float32, numpy=
    array([[[[3.],
             [4.]],
            [[6.],
             [7.]]]], dtype=float32)>

  For example, for `stride=(2, 2)` and `padding="valid"`:

  >>> x = tf.constant([[1., 2., 3., 4.],
  ...                  [5., 6., 7., 8.],
  ...                  [9., 10., 11., 12.]])
  >>> x = tf.reshape(x, [1, 3, 4, 1])
  >>> avg_pool_2d = tf.keras.layers.AveragePooling2D(pool_size=(2, 2),
  ...    strides=(2, 2), padding='valid')
  >>> avg_pool_2d(x)
  <tf.Tensor: shape=(1, 1, 2, 1), dtype=float32, numpy=
    array([[[[3.5],
             [5.5]]]], dtype=float32)>

  For example, for `strides=(1, 1)` and `padding="same"`:

  >>> x = tf.constant([[1., 2., 3.],
  ...                  [4., 5., 6.],
  ...                  [7., 8., 9.]])
  >>> x = tf.reshape(x, [1, 3, 3, 1])
  >>> avg_pool_2d = tf.keras.layers.AveragePooling2D(pool_size=(2, 2),
  ...    strides=(1, 1), padding='same')
  >>> avg_pool_2d(x)
  <tf.Tensor: shape=(1, 3, 3, 1), dtype=float32, numpy=
    array([[[[3.],
             [4.],
             [4.5]],
            [[6.],
             [7.],
             [7.5]],
            [[7.5],
             [8.5],
             [9.]]]], dtype=float32)>

  Args:
    pool_size: integer or tuple of 2 integers,
      factors by which to downscale (vertical, horizontal).
      `(2, 2)` will halve the input in both spatial dimension.
      If only one integer is specified, the same window length
      will be used for both dimensions.
    strides: Integer, tuple of 2 integers, or None.
      Strides values.
      If None, it will default to `pool_size`.
    padding: One of `"valid"` or `"same"` (case-insensitive).
      `"valid"` means no padding. `"same"` results in padding evenly to
      the left/right or up/down of the input such that output has the same
      height/width dimension as the input.
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, height, width, channels)` while `channels_first`
      corresponds to inputs with shape
      `(batch, channels, height, width)`.
      It defaults to the `image_data_format` value found in your
      Keras config file at `~/.keras/keras.json`.
      If you never set it, then it will be "channels_last".

  Input shape:
    - If `data_format='channels_last'`:
      4D tensor with shape `(batch_size, rows, cols, channels)`.
    - If `data_format='channels_first'`:
      4D tensor with shape `(batch_size, channels, rows, cols)`.

  Output shape:
    - If `data_format='channels_last'`:
      4D tensor with shape `(batch_size, pooled_rows, pooled_cols, channels)`.
    - If `data_format='channels_first'`:
      4D tensor with shape `(batch_size, channels, pooled_rows, pooled_cols)`.
  r#   r#   Nr   c                s(   t t| jtjf||||d| d S )N)r   r   r   r   )r   rL   r   r	   Zavg_pool)r   r   r   r   r   r   )r    r!   r"   r   {  s    
zAveragePooling2D.__init__)rM   Nr   N)r6   r7   r8   r9   r   r:   r!   r!   )r    r"   rL     s
   d   rL   c                   s>   e Zd ZdZd fdd	Zdd Zd	d
 Z fddZ  ZS )	Pooling3Dav  Pooling layer for arbitrary pooling functions, for 3D inputs.

  This class only exists for code reuse. It will never be an exposed API.

  Args:
    pool_function: The pooling function to apply, e.g. `tf.nn.max_pool2d`.
    pool_size: An integer or tuple/list of 3 integers:
      (pool_depth, pool_height, pool_width)
      specifying the size of the pooling window.
      Can be a single integer to specify the same value for
      all spatial dimensions.
    strides: An integer or tuple/list of 3 integers,
      specifying the strides of the pooling operation.
      Can be a single integer to specify the same value for
      all spatial dimensions.
    padding: A string. The padding method, either 'valid' or 'same'.
      Case-insensitive.
    data_format: A string, one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, depth, height, width, channels)`
      while `channels_first` corresponds to
      inputs with shape `(batch, channels, depth, height, width)`.
    name: A string, the name of the layer.
  r   r   Nc                s   t t| jf d|i| |d kr*t }|d kr6|}|| _t|dd| _t|dd| _	t
|| _t|| _tdd| _d S )Nr   r   r   r      )r   )r   rN   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )r    r!   r"   r     s    zPooling3D.__init__c             C   sd   d| j  d }d| j d }| jdkr2t|d}| j|||| j d}| jdkr`t|d}|S )N)r   r(   )r   r#   r   rD   r   )rE   r   r   )r   rD   r   r#   r   )r   r   r   r   Z	transposer   r   rF   )r   r%   rG   r   r&   r!   r!   r"   r'     s    

zPooling3D.callc             C   s   t | }| jdkr2|d }|d }|d }n|d }|d }|d }t|| jd | j| jd }t|| jd | j| jd }t|| jd | j| jd }| jdkrt |d |d |||gS t |d ||||d gS d S )Nr(   r#   r   rD   r   r   )	r   r)   r*   r   r   r+   r   r   r   )r   r,   Zlen_dim1Zlen_dim2Zlen_dim3r!   r!   r"   r/     s&    


zPooling3D.compute_output_shapec                s@   | j | j| j| jd}tt|  }tt|	 t|	  S )N)r   r   r   r   )
r   r   r   r   r   rN   r0   r1   r2   r3   )r   r4   r5   )r    r!   r"   r0     s    
zPooling3D.get_config)r   r   N)	r6   r7   r8   r9   r   r'   r/   r0   r:   r!   r!   )r    r"   rN     s    rN   zkeras.layers.MaxPool3Dzkeras.layers.MaxPooling3Dc                   s"   e Zd ZdZd fdd	Z  ZS )MaxPooling3Da  Max pooling operation for 3D data (spatial or spatio-temporal).

  Downsamples the input along its spatial dimensions (depth, height, and width)
  by taking the maximum value over an input window
  (of size defined by `pool_size`) for each channel of the input.
  The window is shifted by `strides` along each dimension.

  Args:
    pool_size: Tuple of 3 integers,
      factors by which to downscale (dim1, dim2, dim3).
      `(2, 2, 2)` will halve the size of the 3D input in each dimension.
    strides: tuple of 3 integers, or None. Strides values.
    padding: One of `"valid"` or `"same"` (case-insensitive).
      `"valid"` means no padding. `"same"` results in padding evenly to
      the left/right or up/down of the input such that output has the same
      height/width dimension as the input.
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
      while `channels_first` corresponds to inputs with shape
      `(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
      It defaults to the `image_data_format` value found in your
      Keras config file at `~/.keras/keras.json`.
      If you never set it, then it will be "channels_last".

  Input shape:
    - If `data_format='channels_last'`:
      5D tensor with shape:
      `(batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
    - If `data_format='channels_first'`:
      5D tensor with shape:
      `(batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)`

  Output shape:
    - If `data_format='channels_last'`:
      5D tensor with shape:
      `(batch_size, pooled_dim1, pooled_dim2, pooled_dim3, channels)`
    - If `data_format='channels_first'`:
      5D tensor with shape:
      `(batch_size, channels, pooled_dim1, pooled_dim2, pooled_dim3)`

  Example:

  ```python
  depth = 30
  height = 30
  width = 30
  input_channels = 3

  inputs = tf.keras.Input(shape=(depth, height, width, input_channels))
  layer = tf.keras.layers.MaxPooling3D(pool_size=3)
  outputs = layer(inputs)  # Shape: (batch_size, 10, 10, 10, 3)
  ```
  r#   r#   r#   Nr   c                s(   t t| jtjf||||d| d S )N)r   r   r   r   )r   rP   r   r	   Z
max_pool3d)r   r   r   r   r   r   )r    r!   r"   r   "  s    
zMaxPooling3D.__init__)rQ   Nr   N)r6   r7   r8   r9   r   r:   r!   r!   )r    r"   rP     s
   9   rP   zkeras.layers.AveragePooling3Dzkeras.layers.AvgPool3Dc                   s"   e Zd ZdZd fdd	Z  ZS )AveragePooling3Da  Average pooling operation for 3D data (spatial or spatio-temporal).

  Downsamples the input along its spatial dimensions (depth, height, and width)
  by taking the average value over an input window
  (of size defined by `pool_size`) for each channel of the input.
  The window is shifted by `strides` along each dimension.

  Args:
    pool_size: tuple of 3 integers,
      factors by which to downscale (dim1, dim2, dim3).
      `(2, 2, 2)` will halve the size of the 3D input in each dimension.
    strides: tuple of 3 integers, or None. Strides values.
    padding: One of `"valid"` or `"same"` (case-insensitive).
      `"valid"` means no padding. `"same"` results in padding evenly to
      the left/right or up/down of the input such that output has the same
      height/width dimension as the input.
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
      while `channels_first` corresponds to inputs with shape
      `(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
      It defaults to the `image_data_format` value found in your
      Keras config file at `~/.keras/keras.json`.
      If you never set it, then it will be "channels_last".

  Input shape:
    - If `data_format='channels_last'`:
      5D tensor with shape:
      `(batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
    - If `data_format='channels_first'`:
      5D tensor with shape:
      `(batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)`

  Output shape:
    - If `data_format='channels_last'`:
      5D tensor with shape:
      `(batch_size, pooled_dim1, pooled_dim2, pooled_dim3, channels)`
    - If `data_format='channels_first'`:
      5D tensor with shape:
      `(batch_size, channels, pooled_dim1, pooled_dim2, pooled_dim3)`

  Example:

  ```python
  depth = 30
  height = 30
  width = 30
  input_channels = 3

  inputs = tf.keras.Input(shape=(depth, height, width, input_channels))
  layer = tf.keras.layers.AveragePooling3D(pool_size=3)
  outputs = layer(inputs)  # Shape: (batch_size, 10, 10, 10, 3)
  ```
  r#   r#   r#   Nr   c                s(   t t| jtjf||||d| d S )N)r   r   r   r   )r   rR   r   r	   Z
avg_pool3d)r   r   r   r   r   r   )r    r!   r"   r   i  s    
zAveragePooling3D.__init__)rS   Nr   N)r6   r7   r8   r9   r   r:   r!   r!   )r    r"   rR   .  s
   9   rR   c                   s>   e Zd ZdZd fdd	Zdd Zdd	 Z fd
dZ  ZS )GlobalPooling1Dz6Abstract class for different global pooling 1D layers.r   Fc                s4   t t| jf | tdd| _t|| _|| _d S )Nr   )r   )	r   rT   r   r   r   r   r   r   keepdims)r   r   rU   r   )r    r!   r"   r   x  s    zGlobalPooling1D.__init__c             C   s   t | }| jdkrN| jr6t |d |d dgS t |d |d gS n4| jrlt |d d|d gS t |d |d gS d S )Nr(   r   r   r#   )r   r)   r*   r   rU   )r   r,   r!   r!   r"   r/   ~  s    
z$GlobalPooling1D.compute_output_shapec             C   s   t d S )N)NotImplementedError)r   r%   r!   r!   r"   r'     s    zGlobalPooling1D.callc                s8   | j | jd}tt|  }tt| t|  S )N)r   rU   )r   rU   r   rT   r0   r1   r2   r3   )r   r4   r5   )r    r!   r"   r0     s    zGlobalPooling1D.get_config)r   F)	r6   r7   r8   r9   r   r/   r'   r0   r:   r!   r!   )r    r"   rT   u  s
   rT   z#keras.layers.GlobalAveragePooling1Dzkeras.layers.GlobalAvgPool1Dc                   s6   e Zd ZdZd
 fdd	ZdddZddd	Z  ZS )GlobalAveragePooling1DaW  Global average pooling operation for temporal data.

  Examples:

  >>> input_shape = (2, 3, 4)
  >>> x = tf.random.normal(input_shape)
  >>> y = tf.keras.layers.GlobalAveragePooling1D()(x)
  >>> print(y.shape)
  (2, 4)

  Args:
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, steps, features)` while `channels_first`
      corresponds to inputs with shape
      `(batch, features, steps)`.
    keepdims: A boolean, whether to keep the temporal dimension or not.
      If `keepdims` is `False` (default), the rank of the tensor is reduced
      for spatial dimensions.
      If `keepdims` is `True`, the temporal dimension are retained with
      length 1.
      The behavior is the same as for `tf.reduce_mean` or `np.mean`.

  Call arguments:
    inputs: A 3D tensor.
    mask: Binary tensor of shape `(batch_size, steps)` indicating whether
      a given step should be masked (excluded from the average).

  Input shape:
    - If `data_format='channels_last'`:
      3D tensor with shape:
      `(batch_size, steps, features)`
    - If `data_format='channels_first'`:
      3D tensor with shape:
      `(batch_size, features, steps)`

  Output shape:
    - If `keepdims`=False:
      2D tensor with shape `(batch_size, features)`.
    - If `keepdims`=True:
      - If `data_format='channels_last'`:
        3D tensor with shape `(batch_size, 1, features)`
      - If `data_format='channels_first'`:
        3D tensor with shape `(batch_size, features, 1)`
  r   c                s$   t t| jf d|i| d| _d S )Nr   T)r   rW   r   Zsupports_masking)r   r   r   )r    r!   r"   r     s    zGlobalAveragePooling1D.__init__Nc             C   s   | j dkrdnd}|d k	rrt||d j}t|| j dkr@dnd}||9 }tj||| jdtj	||| jd S tj
||| jdS d S )Nr   r   r#   r   )axisrU   )r   r   castZdtyper   r$   r   sumrU   Z
reduce_summean)r   r%   mask
steps_axisr!   r!   r"   r'     s    zGlobalAveragePooling1D.callc             C   s   d S )Nr!   )r   r%   r\   r!   r!   r"   compute_mask  s    z#GlobalAveragePooling1D.compute_mask)r   )N)N)r6   r7   r8   r9   r   r'   r^   r:   r!   r!   )r    r"   rW     s   1
rW   zkeras.layers.GlobalMaxPool1Dzkeras.layers.GlobalMaxPooling1Dc               @   s   e Zd ZdZdd ZdS )GlobalMaxPooling1Da,  Global max pooling operation for 1D temporal data.

  Downsamples the input representation by taking the maximum value over
  the time dimension.

  For example:

  >>> x = tf.constant([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.]])
  >>> x = tf.reshape(x, [3, 3, 1])
  >>> x
  <tf.Tensor: shape=(3, 3, 1), dtype=float32, numpy=
  array([[[1.], [2.], [3.]],
         [[4.], [5.], [6.]],
         [[7.], [8.], [9.]]], dtype=float32)>
  >>> max_pool_1d = tf.keras.layers.GlobalMaxPooling1D()
  >>> max_pool_1d(x)
  <tf.Tensor: shape=(3, 1), dtype=float32, numpy=
  array([[3.],
         [6.],
         [9.], dtype=float32)>

  Args:
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, steps, features)` while `channels_first`
      corresponds to inputs with shape
      `(batch, features, steps)`.
    keepdims: A boolean, whether to keep the temporal dimension or not.
      If `keepdims` is `False` (default), the rank of the tensor is reduced
      for spatial dimensions.
      If `keepdims` is `True`, the temporal dimension are retained with
      length 1.
      The behavior is the same as for `tf.reduce_max` or `np.max`.

  Input shape:
    - If `data_format='channels_last'`:
      3D tensor with shape:
      `(batch_size, steps, features)`
    - If `data_format='channels_first'`:
      3D tensor with shape:
      `(batch_size, features, steps)`

  Output shape:
    - If `keepdims`=False:
      2D tensor with shape `(batch_size, features)`.
    - If `keepdims`=True:
      - If `data_format='channels_last'`:
        3D tensor with shape `(batch_size, 1, features)`
      - If `data_format='channels_first'`:
        3D tensor with shape `(batch_size, features, 1)`
  c             C   s$   | j dkrdnd}tj||| jdS )Nr   r   r#   )rX   rU   )r   r   r<   rU   )r   r%   r]   r!   r!   r"   r'     s    zGlobalMaxPooling1D.callN)r6   r7   r8   r9   r'   r!   r!   r!   r"   r_     s   6r_   c                   s>   e Zd ZdZd fdd	Zdd Zdd	 Z fd
dZ  ZS )GlobalPooling2Dz9Abstract class for different global pooling 2D layers.
  NFc                s4   t t| jf | t|| _tdd| _|| _d S )NrD   )r   )	r   r`   r   r   r   r   r   r   rU   )r   r   rU   r   )r    r!   r"   r     s    zGlobalPooling2D.__init__c             C   s   t | }| jdkrP| jr8t |d dd|d gS t |d |d gS n6| jrpt |d |d ddgS t |d |d gS d S )Nr   r   r   r   )r   r)   r*   r   rU   )r   r,   r!   r!   r"   r/   %  s    
z$GlobalPooling2D.compute_output_shapec             C   s   t d S )N)rV   )r   r%   r!   r!   r"   r'   2  s    zGlobalPooling2D.callc                s8   | j | jd}tt|  }tt| t|  S )N)r   rU   )r   rU   r   r`   r0   r1   r2   r3   )r   r4   r5   )r    r!   r"   r0   5  s    zGlobalPooling2D.get_config)NF)	r6   r7   r8   r9   r   r/   r'   r0   r:   r!   r!   )r    r"   r`     s
   r`   z#keras.layers.GlobalAveragePooling2Dzkeras.layers.GlobalAvgPool2Dc               @   s   e Zd ZdZdd ZdS )GlobalAveragePooling2Da  Global average pooling operation for spatial data.

  Examples:

  >>> input_shape = (2, 4, 5, 3)
  >>> x = tf.random.normal(input_shape)
  >>> y = tf.keras.layers.GlobalAveragePooling2D()(x)
  >>> print(y.shape)
  (2, 3)

  Args:
      data_format: A string,
        one of `channels_last` (default) or `channels_first`.
        The ordering of the dimensions in the inputs.
        `channels_last` corresponds to inputs with shape
        `(batch, height, width, channels)` while `channels_first`
        corresponds to inputs with shape
        `(batch, channels, height, width)`.
        It defaults to the `image_data_format` value found in your
        Keras config file at `~/.keras/keras.json`.
        If you never set it, then it will be "channels_last".
      keepdims: A boolean, whether to keep the spatial dimensions or not.
        If `keepdims` is `False` (default), the rank of the tensor is reduced
        for spatial dimensions.
        If `keepdims` is `True`, the spatial dimensions are retained with
        length 1.
        The behavior is the same as for `tf.reduce_mean` or `np.mean`.

  Input shape:
    - If `data_format='channels_last'`:
      4D tensor with shape `(batch_size, rows, cols, channels)`.
    - If `data_format='channels_first'`:
      4D tensor with shape `(batch_size, channels, rows, cols)`.

  Output shape:
    - If `keepdims`=False:
      2D tensor with shape `(batch_size, channels)`.
    - If `keepdims`=True:
      - If `data_format='channels_last'`:
        4D tensor with shape `(batch_size, 1, 1, channels)`
      - If `data_format='channels_first'`:
        4D tensor with shape `(batch_size, channels, 1, 1)`
  c             C   s:   | j dkr tj|ddg| jdS tj|ddg| jdS d S )Nr   r   r#   )rX   rU   r   )r   r   r[   rU   )r   r%   r!   r!   r"   r'   j  s    
zGlobalAveragePooling2D.callN)r6   r7   r8   r9   r'   r!   r!   r!   r"   ra   ;  s   -ra   zkeras.layers.GlobalMaxPool2Dzkeras.layers.GlobalMaxPooling2Dc               @   s   e Zd ZdZdd ZdS )GlobalMaxPooling2DaX  Global max pooling operation for spatial data.

  Examples:

  >>> input_shape = (2, 4, 5, 3)
  >>> x = tf.random.normal(input_shape)
  >>> y = tf.keras.layers.GlobalMaxPool2D()(x)
  >>> print(y.shape)
  (2, 3)

  Args:
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, height, width, channels)` while `channels_first`
      corresponds to inputs with shape
      `(batch, channels, height, width)`.
      It defaults to the `image_data_format` value found in your
      Keras config file at `~/.keras/keras.json`.
      If you never set it, then it will be "channels_last".
    keepdims: A boolean, whether to keep the spatial dimensions or not.
      If `keepdims` is `False` (default), the rank of the tensor is reduced
      for spatial dimensions.
      If `keepdims` is `True`, the spatial dimensions are retained with
      length 1.
      The behavior is the same as for `tf.reduce_max` or `np.max`.

  Input shape:
    - If `data_format='channels_last'`:
      4D tensor with shape `(batch_size, rows, cols, channels)`.
    - If `data_format='channels_first'`:
      4D tensor with shape `(batch_size, channels, rows, cols)`.

  Output shape:
    - If `keepdims`=False:
      2D tensor with shape `(batch_size, channels)`.
    - If `keepdims`=True:
      - If `data_format='channels_last'`:
        4D tensor with shape `(batch_size, 1, 1, channels)`
      - If `data_format='channels_first'`:
        4D tensor with shape `(batch_size, channels, 1, 1)`
  c             C   s:   | j dkr tj|ddg| jdS tj|ddg| jdS d S )Nr   r   r#   )rX   rU   r   )r   r   r<   rU   )r   r%   r!   r!   r"   r'     s    
zGlobalMaxPooling2D.callN)r6   r7   r8   r9   r'   r!   r!   r!   r"   rb   q  s   ,rb   c                   s>   e Zd ZdZd fdd	Zdd Zdd	 Z fd
dZ  ZS )GlobalPooling3Dz6Abstract class for different global pooling 3D layers.NFc                s4   t t| jf | t|| _tdd| _|| _d S )NrO   )r   )	r   rc   r   r   r   r   r   r   rU   )r   r   rU   r   )r    r!   r"   r     s    zGlobalPooling3D.__init__c             C   s   t | }| jdkrR| jr:t |d ddd|d gS t |d |d gS n8| jrtt |d |d dddgS t |d |d gS d S )Nr   r   r   rD   )r   r)   r*   r   rU   )r   r,   r!   r!   r"   r/     s    
z$GlobalPooling3D.compute_output_shapec             C   s   t d S )N)rV   )r   r%   r!   r!   r"   r'     s    zGlobalPooling3D.callc                s8   | j | jd}tt|  }tt| t|  S )N)r   rU   )r   rU   r   rc   r0   r1   r2   r3   )r   r4   r5   )r    r!   r"   r0     s    zGlobalPooling3D.get_config)NF)	r6   r7   r8   r9   r   r/   r'   r0   r:   r!   r!   )r    r"   rc     s
   rc   z#keras.layers.GlobalAveragePooling3Dzkeras.layers.GlobalAvgPool3Dc               @   s   e Zd ZdZdd ZdS )GlobalAveragePooling3Da9  Global Average pooling operation for 3D data.

  Args:
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
      while `channels_first` corresponds to inputs with shape
      `(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
      It defaults to the `image_data_format` value found in your
      Keras config file at `~/.keras/keras.json`.
      If you never set it, then it will be "channels_last".
    keepdims: A boolean, whether to keep the spatial dimensions or not.
      If `keepdims` is `False` (default), the rank of the tensor is reduced
      for spatial dimensions.
      If `keepdims` is `True`, the spatial dimensions are retained with
      length 1.
      The behavior is the same as for `tf.reduce_mean` or `np.mean`.

  Input shape:
    - If `data_format='channels_last'`:
      5D tensor with shape:
      `(batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
    - If `data_format='channels_first'`:
      5D tensor with shape:
      `(batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)`

  Output shape:
    - If `keepdims`=False:
      2D tensor with shape `(batch_size, channels)`.
    - If `keepdims`=True:
      - If `data_format='channels_last'`:
        5D tensor with shape `(batch_size, 1, 1, 1, channels)`
      - If `data_format='channels_first'`:
        5D tensor with shape `(batch_size, channels, 1, 1, 1)`
  c             C   s>   | j dkr"tj|dddg| jdS tj|dddg| jdS d S )Nr   r   r#   r   )rX   rU   rD   )r   r   r[   rU   )r   r%   r!   r!   r"   r'     s    
zGlobalAveragePooling3D.callN)r6   r7   r8   r9   r'   r!   r!   r!   r"   rd     s   'rd   zkeras.layers.GlobalMaxPool3Dzkeras.layers.GlobalMaxPooling3Dc               @   s   e Zd ZdZdd ZdS )GlobalMaxPooling3Da3  Global Max pooling operation for 3D data.

  Args:
    data_format: A string,
      one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
      while `channels_first` corresponds to inputs with shape
      `(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
      It defaults to the `image_data_format` value found in your
      Keras config file at `~/.keras/keras.json`.
      If you never set it, then it will be "channels_last".
    keepdims: A boolean, whether to keep the spatial dimensions or not.
      If `keepdims` is `False` (default), the rank of the tensor is reduced
      for spatial dimensions.
      If `keepdims` is `True`, the spatial dimensions are retained with
      length 1.
      The behavior is the same as for `tf.reduce_max` or `np.max`.

  Input shape:
    - If `data_format='channels_last'`:
      5D tensor with shape:
      `(batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
    - If `data_format='channels_first'`:
      5D tensor with shape:
      `(batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)`

  Output shape:
    - If `keepdims`=False:
      2D tensor with shape `(batch_size, channels)`.
    - If `keepdims`=True:
      - If `data_format='channels_last'`:
        5D tensor with shape `(batch_size, 1, 1, 1, channels)`
      - If `data_format='channels_first'`:
        5D tensor with shape `(batch_size, channels, 1, 1, 1)`
  c             C   s>   | j dkr"tj|dddg| jdS tj|dddg| jdS d S )Nr   r   r#   r   )rX   rU   rD   )r   r   r<   rU   )r   r%   r!   r!   r"   r'     s    
zGlobalMaxPooling3D.callN)r6   r7   r8   r9   r'   r!   r!   r!   r"   re     s   &re   )0r9   r>   Ztensorflow.python.frameworkr   Ztensorflow.python.kerasr   Z)tensorflow.python.keras.engine.base_layerr   Z)tensorflow.python.keras.engine.input_specr   Ztensorflow.python.keras.utilsr   Ztensorflow.python.opsr   r   r	   Z tensorflow.python.util.tf_exportr
   r   r;   rA   rC   rJ   rL   rN   rP   rR   rT   rW   r_   r`   ra   rb   rc   rd   re   Z	AvgPool1DZ	MaxPool1DZ	AvgPool2DZ	MaxPool2DZ	AvgPool3DZ	MaxPool3DZGlobalMaxPool1DZGlobalMaxPool2DZGlobalMaxPool3DZGlobalAvgPool1DZGlobalAvgPool2DZGlobalAvgPool3Dr!   r!   r!   r"   <module>   sp   M[oU 	q`FFH< 44!.0