
    BVh                     ,   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  G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Z G d! d"e      Z G d# d$e      Z G d% d&e      Z G d' d(e      Z G d) d*e      Z G d+ d,e      Z  G d- d.e      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-y)/zPooling layers.    N)tensor_shape)backend)Layer)	InputSpec)
conv_utils)	array_ops)math_ops)nnc                   >     e Zd ZdZ	 	 d fd	Zd Zd Z fdZ x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.
  c                 l   t        t        | 
  dd|i| |t        j                         }||}|| _        t        j                  |dd      | _        t        j                  |dd      | _	        t        j                  |      | _        t        j                  |      | _        t        d      | _        y )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__s	           V/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/keras/layers/pooling.pyr   zPooling1D.__init__4        
)T#888--/kg&D//	1kJDN--gq)DDL//8DL!77DDQ'DO    c                    | j                   dk(  rdnd}t        j                  ||      }| j                  || j                  dz   | j
                  dz   | j                  | j                         }t        j                  ||      S )Nchannels_last   r   r   )r   r   r   )r   r   expand_dimsr   r   r   r   squeeze)r!   inputspad_axisoutputss       r$   callzPooling1D.callC   s}    $$7qQH""684F  t#$$ ! &G Wh//r&   c                    t        j                  |      j                         }| j                  dk(  r|d   }|d   }n
|d   }|d   }t	        j
                  || j                  d   | j                  | j                  d         }| j                  dk(  rt        j                  |d   ||g      S t        j                  |d   ||g      S )Nchannels_firstr)   r   r   	r   TensorShapeas_listr   r   conv_output_lengthr   r   r   )r!   input_shapestepsfeatureslengths        r$   compute_output_shapezPooling1D.compute_output_shapeN   s    **;7??AK++!neQh!neQh**5+/>>!+<+/<<+/<<?<F ++%%{1~x&HII%%{1~vx&HIIr&   c                     | j                   | j                  | j                  | j                  d}t        t
        |          }t        t        |j                               t        |j                               z         S )N)r   r   r   r   )
r   r   r   r   r   r   
get_configdictlistitemsr!   configbase_configr#   s      r$   r=   zPooling1D.get_config_   sb    <<^^<<''	F 	435K[&&()D,@@AAr&   validr(   N	__name__
__module____qualname____doc__r   r0   r;   r=   __classcell__r#   s   @r$   r   r      s,    . -<(	0J"B Br&   r   c                   (     e Zd ZdZ	 	 d fd	Z x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)`.
  c                 ~    t        t        | 
  t        j                  t
        j                  d      f||||d| y )Nmax	pool_moder   r   r   r   )r   rN   r   	functoolspartialr   pool2dr!   r   r   r   r   r"   r#   s         r$   r   zMaxPooling1D.__init__   sC     
,&'..E: r&   r)   NrE   r(   rG   rH   rI   rJ   r   rK   rL   s   @r$   rN   rN   j   s    L\ +/,;	 	r&   rN   c                   (     e Zd ZdZ	 	 d fd	Z x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)`.
  c                 ~    t        t        | 
  t        j                  t
        j                  d      f||||d| y )NavgrQ   rS   )r   r[   r   rT   rU   r   rV   rW   s         r$   r   zAveragePooling1D.__init__)  sB    	
D*'..E: r&   rX   rY   rL   s   @r$   r[   r[      s    aF +/,; r&   r[   c                   >     e Zd ZdZ	 	 d fd	Zd Zd Z fdZ x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.
  c                 l   t        t        | 
  dd|i| |t        j                         }||}|| _        t        j                  |dd      | _        t        j                  |dd      | _	        t        j                  |      | _        t        j                  |      | _        t        d      | _        y )Nr   r)   r   r      r   r   )r   r_   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    s	           r$   r   zPooling2D.__init__M  r%   r&   c           
      B   | j                   dk(  r%d| j                  z   dz   }d| j                  z   dz   }nd| j                  z   }d| j                  z   }| j                  |||| j                  j                         t        j                  | j                   d            }|S )Nr(   r*   )r   r   ra   )ksizer   r   r   )r   r   r   r   r   upperr   convert_data_formatr!   r-   
pool_shaper   r/   s        r$   r0   zPooling2D.call\  s    ?*$..(4/jt||#d*gDNN*j%g  ""$2243C3CQG ! IG Nr&   c                    t        j                  |      j                         }| j                  dk(  r|d   }|d   }n
|d   }|d   }t	        j
                  || j                  d   | j                  | j                  d         }t	        j
                  || j                  d   | j                  | j                  d         }| j                  dk(  rt        j                  |d   |d   ||g      S t        j                  |d   |||d   g      S )Nr2   r)   r   r   r   r3   )r!   r7   rowscolss       r$   r;   zPooling2D.compute_output_shapek  s	   **;7??AK++^d^d^d^d((t~~a/@$,,)-a:D((t~~a/@$,,)-a:D++%%q>;q>4
68 8 %%q>4{1~
68 8r&   c                     | j                   | j                  | j                  | j                  d}t        t
        |          }t        t        |j                               t        |j                               z         S N)r   r   r   r   )
r   r   r   r   r   r_   r=   r>   r?   r@   rA   s      r$   r=   zPooling2D.get_config~  b    ^^<<<<''	F 	435K[&&()D,@@AAr&   )rE   NNrF   rL   s   @r$   r_   r_   4  s+    2 -1(8&B Br&   r_   c                   ,     e Zd ZdZ	 	 	 	 d fd	Z x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.
  c                 T    t        t        | 
  t        j                  f||||d| y NrS   )r   ro   r   r
   max_poolrW   s         r$   r   zMaxPooling2D.__init__  s4     
,&
<W[< 5;<r&   )r)   r)   NrE   NrY   rL   s   @r$   ro   ro     s"    yx  		< 	<r&   ro   c                   ,     e Zd ZdZ	 	 	 	 d fd	Z x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)`.
  c                 T    t        t        | 
  t        j                  f||||d| y rq   )r   ru   r   r
   avg_poolrW   s         r$   r   zAveragePooling2D.__init__v  s5     

D*
<W[< 5;<r&   rs   rY   rL   s   @r$   ru   ru     s"    bJ  		< 	<r&   ru   c                   >     e Zd ZdZ	 	 d fd	Zd Zd Z fdZ x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.
  c                 l   t        t        | 
  dd|i| |t        j                         }||}|| _        t        j                  |dd      | _        t        j                  |dd      | _	        t        j                  |      | _        t        j                  |      | _        t        d      | _        y )Nr   r   r   r      r   r   )r   ry   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    s	           r$   r   zPooling3D.__init__  r%   r&   c                 <   d| j                   z   dz   }d| j                  z   dz   }| j                  dk(  rt        j                  |d      }| j                  |||| j                  j                               }| j                  dk(  rt        j                  |d      }|S )Nr*   r2   )r   r)   r   ra   r   )rc   r   r   )r   ra   r   r)   r   )r   r   r   r   	transposer   r   rd   rf   s        r$   r0   zPooling3D.call  s    &-JT\\!D(G++ ""6?;f  ""$	 ! &G ++##G_=gNr&   c                    t        j                  |      j                         }| j                  dk(  r|d   }|d   }|d   }n|d   }|d   }|d   }t	        j
                  || j                  d   | j                  | j                  d         }t	        j
                  || j                  d   | j                  | j                  d         }t	        j
                  || j                  d   | j                  | j                  d         }| j                  dk(  r t        j                  |d   |d   |||g      S t        j                  |d   ||||d   g      S )Nr2   r)   r   ra   r   r   r3   )r!   r7   len_dim1len_dim2len_dim3s        r$   r;   zPooling3D.compute_output_shape  sT   **;7??AK++QhQhQhQhQhQh,,Xt~~a7H-1\\4<<?LH,,Xt~~a7H-1\\4<<?LH,,Xt~~a7H-1\\4<<?LH++%%q>;q>8Xx
HJ J %%q>8XxQ
HJ Jr&   c                     | j                   | j                  | j                  | j                  d}t        t
        |          }t        t        |j                               t        |j                               z         S rl   )
r   r   r   r   r   ry   r=   r>   r?   r@   rA   s      r$   r=   zPooling3D.get_config  rm   r&   rD   rF   rL   s   @r$   ry   ry     s,    6 -<((J.B Br&   ry   c                   ,     e Zd ZdZ	 	 	 	 d fd	Z x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)
  ```
  c                 T    t        t        | 
  t        j                  f||||d| y rq   )r   r   r   r
   
max_pool3drW   s         r$   r   zMaxPooling3D.__init__  s4     
,&
<W[< 5;<r&   )r)   r)   r)   NrE   NrY   rL   s   @r$   r   r     !    7t #		< 	<r&   r   c                   ,     e Zd ZdZ	 	 	 	 d fd	Z x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)
  ```
  c                 T    t        t        | 
  t        j                  f||||d| y rq   )r   r   r   r
   
avg_pool3drW   s         r$   r   zAveragePooling3D.__init__b  s5     

D*
<W[< 5;<r&   r   rY   rL   s   @r$   r   r   (  r   r&   r   c                   :     e Zd ZdZd fd	Zd Zd Z fdZ xZS )GlobalPooling1Dz6Abstract class for different global pooling 1D layers.c                     t        t        | 
  di | t        d      | _        t        j                  |      | _        || _        y )Nr   r   r   )	r   r   r   r   r   r   r   r   keepdimsr!   r   r   r"   r#   s       r$   r   zGlobalPooling1D.__init__q  s;    	/4)3F3Q'DO!77DDDMr&   c                    t        j                  |      j                         }| j                  dk(  rG| j                  rt        j                  |d   |d   dg      S t        j                  |d   |d   g      S | j                  rt        j                  |d   d|d   g      S t        j                  |d   |d   g      S )Nr2   r   r   r)   r   r4   r5   r   r   r!   r7   s     r$   r;   z$GlobalPooling1D.compute_output_shapew  s    **;7??AK++	''QQ(KLL''QQ(HII	''QKN(KLL''QQ(HIIr&   c                     t         NNotImplementedErrorr!   r-   s     r$   r0   zGlobalPooling1D.call      
r&   c                     | j                   | j                  d}t        t        |          }t        t        |j                               t        |j                               z         S N)r   r   )r   r   r   r   r=   r>   r?   r@   rA   s      r$   r=   zGlobalPooling1D.get_config  O    !--4==IF9;K[&&()D,@@AAr&   )r(   F	rG   rH   rI   rJ   r   r;   r0   r=   rK   rL   s   @r$   r   r   n  s"    >JB Br&   r   c                   4     e Zd ZdZd fd	ZddZddZ x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)`
  c                 >    t        t        | 
  dd|i| d| _        y )Nr   Tr   )r   r   r   supports_masking)r!   r   r"   r#   s      r$   r   zGlobalAveragePooling1D.__init__  s*    	
 $0 ;[ ;39; Dr&   c                    | j                   dk(  rdnd}|t        j                  ||d   j                        }t	        j
                  || j                   dk(  rdnd      }||z  }t        j                  ||| j                        t        j                  ||| j                        z  S t        j                  ||| j                        S )Nr(   r   r)   r   axisr   )r   r	   castdtyper   r+   r   sumr   
reduce_summean)r!   r-   mask
steps_axiss       r$   r0   zGlobalAveragePooling1D.call  s    &&/9qJ]]41d""
T%%8aAdnf[[
z=="$,$7$7dmm%== =
 \\&zDMMJJr&   c                      y r   r   )r!   r-   r   s      r$   compute_maskz#GlobalAveragePooling1D.compute_mask  s    r&   )r(   r   )rG   rH   rI   rJ   r   r0   r   rK   rL   s   @r$   r   r     s    .`!
Kr&   r   c                       e Zd ZdZd Zy)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                 l    | j                   dk(  rdnd}t        j                  ||| j                        S )Nr(   r   r)   r   r   r   rP   r   )r!   r-   r   s      r$   r0   zGlobalMaxPooling1D.call  s-    &&/9qJ;;vJGGr&   NrG   rH   rI   rJ   r0   r   r&   r$   r   r     s    4lHr&   r   c                   :     e Zd ZdZd fd	Zd Zd Z fdZ xZS )GlobalPooling2Dz9Abstract class for different global pooling 2D layers.
  c                     t        t        | 
  di | t        j                  |      | _        t        d      | _        || _        y )Nra   r   r   )	r   r   r   r   r   r   r   r   r   r   s       r$   r   zGlobalPooling2D.__init__  ;    	/4)3F3!77DDQ'DODMr&   c                    t        j                  |      j                         }| j                  dk(  rH| j                  rt        j                  |d   dd|d   g      S t        j                  |d   |d   g      S | j                  rt        j                  |d   |d   ddg      S t        j                  |d   |d   g      S )Nr(   r   r   r   r   r   s     r$   r;   z$GlobalPooling2D.compute_output_shape  s    **;7??AK?*	''QA{1~(NOO''QQ(HII	''QQA(NOO''QQ(HIIr&   c                     t         r   r   r   s     r$   r0   zGlobalPooling2D.call(  r   r&   c                     | j                   | j                  d}t        t        |          }t        t        |j                               t        |j                               z         S r   )r   r   r   r   r=   r>   r?   r@   rA   s      r$   r=   zGlobalPooling2D.get_config+  r   r&   NFr   rL   s   @r$   r   r     s$    JB Br&   r   c                       e Zd ZdZd Zy)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                     | j                   dk(  r$t        j                  |ddg| j                        S t        j                  |ddg| j                        S Nr(   r   r)   r   r   r   r   r   r   r   s     r$   r0   zGlobalAveragePooling2D.call^  sF    ?*\\&1vFF\\&1vFFr&   Nr   r   r&   r$   r   r   1  s    *XGr&   r   c                       e Zd ZdZd Zy)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                     | j                   dk(  r$t        j                  |ddg| j                        S t        j                  |ddg| j                        S r   r   r   s     r$   r0   zGlobalMaxPooling2D.call  sF    ?*[[q!ft}}EE[[q!ft}}EEr&   Nr   r   r&   r$   r   r   e  s    *XFr&   r   c                   :     e Zd ZdZd fd	Zd Zd Z fdZ xZS )GlobalPooling3Dz6Abstract class for different global pooling 3D layers.c                     t        t        | 
  di | t        j                  |      | _        t        d      | _        || _        y )Nr{   r   r   )	r   r   r   r   r   r   r   r   r   r   s       r$   r   zGlobalPooling3D.__init__  r   r&   c                    t        j                  |      j                         }| j                  dk(  rI| j                  r t        j                  |d   ddd|d   g      S t        j                  |d   |d   g      S | j                  r t        j                  |d   |d   dddg      S t        j                  |d   |d   g      S )Nr(   r   r   ra   r   r   s     r$   r;   z$GlobalPooling3D.compute_output_shape  s    **;7??AK?*	''^Q1k!n57 	7 ''QQ(HII	''^[^Q157 	7 ''QQ(HIIr&   c                     t         r   r   r   s     r$   r0   zGlobalPooling3D.call  r   r&   c                     | j                   | j                  d}t        t        |          }t        t        |j                               t        |j                               z         S r   )r   r   r   r   r=   r>   r?   r@   rA   s      r$   r=   zGlobalPooling3D.get_config  r   r&   r   r   rL   s   @r$   r   r     s"    >JB Br&   r   c                       e Zd ZdZd Zy)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                     | j                   dk(  r$t        j                  |g d| j                        S t        j                  |g d| j                        S Nr(   )r   r)   r   r   )r)   r   ra   r   r   s     r$   r0   zGlobalAveragePooling3D.call  s>    ?*\\&y4==II\\&y4==IIr&   Nr   r   r&   r$   r   r     s    $LJr&   r   c                       e Zd ZdZd Zy)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                     | j                   dk(  r$t        j                  |g d| j                        S t        j                  |g d| j                        S r   r   r   s     r$   r0   zGlobalMaxPooling3D.call  s>    ?*[[i$--HH[[i$--HHr&   Nr   r   r&   r$   r   r     s    $LIr&   r   ).rJ   rT   tensorflow.python.frameworkr   tensorflow.python.kerasr   )tensorflow.python.keras.engine.base_layerr   )tensorflow.python.keras.engine.input_specr   tensorflow.python.keras.utilsr   tensorflow.python.opsr   r	   r
   r   rN   r[   r_   ro   ru   ry   r   r   r   r   r   r   r   r   r   r   r   	AvgPool1D	MaxPool1D	AvgPool2D	MaxPool2D	AvgPool3D	MaxPool3DGlobalMaxPool1DGlobalMaxPool2DGlobalMaxPool3DGlobalAvgPool1DGlobalAvgPool2DGlobalAvgPool3Dr   r&   r$   <module>r      sv     4 + ; ? 4 + * $JB JBZX9 Xvly l^RB RBjE<9 E<Pn<y n<b]B ]B@C<9 C<LC<y C<LBe B>E_ EP9H 9HxBe B@1G_ 1Gh1F 1FhBe BB+J_ +J\+I +I` 						$$$(((r&   