a
    Sic                     @   sn   d Z ddlm  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 edG d	d
 d
eZdS )z&Keras zero-padding layer for 1D input.    N)backend)Layer)	InputSpec)
conv_utils)keras_exportzkeras.layers.ZeroPadding1Dc                       s>   e Zd ZdZd fdd	Zdd Zdd Z fd	d
Z  ZS )ZeroPadding1Da  Zero-padding layer for 1D input (e.g. temporal sequence).

    Examples:

    >>> input_shape = (2, 2, 3)
    >>> x = np.arange(np.prod(input_shape)).reshape(input_shape)
    >>> print(x)
    [[[ 0  1  2]
      [ 3  4  5]]
     [[ 6  7  8]
      [ 9 10 11]]]
    >>> y = tf.keras.layers.ZeroPadding1D(padding=2)(x)
    >>> print(y)
    tf.Tensor(
      [[[ 0  0  0]
        [ 0  0  0]
        [ 0  1  2]
        [ 3  4  5]
        [ 0  0  0]
        [ 0  0  0]]
       [[ 0  0  0]
        [ 0  0  0]
        [ 6  7  8]
        [ 9 10 11]
        [ 0  0  0]
        [ 0  0  0]]], shape=(2, 6, 3), dtype=int64)

    Args:
        padding: Int, or tuple of int (length 2), or dictionary.
            - If int:
            How many zeros to add at the beginning and end of
            the padding dimension (axis 1).
            - If tuple of int (length 2):
            How many zeros to add at the beginning and the end of
            the padding dimension (`(left_pad, right_pad)`).

    Input shape:
        3D tensor with shape `(batch_size, axis_to_pad, features)`

    Output shape:
        3D tensor with shape `(batch_size, padded_axis, features)`
       c                    s6   t  jf i | tj|dddd| _tdd| _d S )N   paddingT)
allow_zero   )ndim)super__init__r   normalize_tupler
   r   
input_spec)selfr
   kwargs	__class__ a/var/www/html/django/DPS/env/lib/python3.9/site-packages/keras/layers/reshaping/zero_padding1d.pyr   J   s
    zZeroPadding1D.__init__c                 C   sF   |d d ur*|d | j d  | j d  }nd }t|d ||d gS )Nr   r   r	   )r
   tfTensorShape)r   input_shapelengthr   r   r   compute_output_shapeQ   s    z"ZeroPadding1D.compute_output_shapec                 C   s   t j|| jdS )N)r
   )r   temporal_paddingr
   )r   inputsr   r   r   callX   s    zZeroPadding1D.callc                    s0   d| j i}t  }tt| t|  S )Nr
   )r
   r   
get_configdictlistitems)r   configbase_configr   r   r   r    [   s    

zZeroPadding1D.get_config)r   )	__name__
__module____qualname____doc__r   r   r   r    __classcell__r   r   r   r   r      s
   +r   )r)   tensorflow.compat.v2compatv2r   kerasr   keras.engine.base_layerr   keras.engine.input_specr   keras.utilsr    tensorflow.python.util.tf_exportr   r   r   r   r   r   <module>   s   