o
    i e                     @   sb   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 edG dd	 d	eZdS )
z Contains the RepeatVector layer.    N)backend)Layer)	InputSpec)keras_exportzkeras.layers.RepeatVectorc                       s<   e Zd ZdZ fddZdd Zdd Z fdd	Z  ZS )
RepeatVectora  Repeats the input n times.

    Example:

    ```python
    model = Sequential()
    model.add(Dense(32, input_dim=32))
    # now: model.output_shape == (None, 32)
    # note: `None` is the batch dimension

    model.add(RepeatVector(3))
    # now: model.output_shape == (None, 3, 32)
    ```

    Args:
      n: Integer, repetition factor.
    Input shape: 2D tensor of shape `(num_samples, features)`.
    Output shape: 3D tensor of shape `(num_samples, n, features)`.
    c                    sF   t  jdi | || _t|tstdt| dtdd| _d S )Nz'Expected an integer value for `n`, got .   )ndim )	super__init__n
isinstanceint	TypeErrortyper   
input_spec)selfr   kwargs	__class__r
   W/var/www/myenv/lib/python3.10/site-packages/keras/src/layers/reshaping/repeat_vector.pyr   2   s   
zRepeatVector.__init__c                 C   s(   t | }t |d | j|d gS )Nr      )tfTensorShapeas_listr   )r   input_shaper
   r
   r   compute_output_shape;   s   z!RepeatVector.compute_output_shapec                 C   s   t || jS )N)r   repeatr   )r   inputsr
   r
   r   call?   s   zRepeatVector.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!   B   s   

zRepeatVector.get_config)	__name__
__module____qualname____doc__r   r   r    r!   __classcell__r
   r
   r   r   r      s    	r   )r*   tensorflow.compat.v2compatv2r   	keras.srcr   keras.src.engine.base_layerr   keras.src.engine.input_specr    tensorflow.python.util.tf_exportr   r   r
   r
   r
   r   <module>   s   