+
    &jt                     T    ^ RI t ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	  ! R R]4      t
R# )    N)Optional)Module)QuantizedEmbeddingc                   j   a a ] tR t^t oRtV3R lV 3R lltR tR tR tR
V3R lR llt	R	t
VtV ;t# )	EmbeddingaZ  Implements a simple lookup table that maps each input integer to a
high-dimensional vector.

Typically used to embed discrete tokens for processing by neural networks.

Args:
    num_embeddings (int): How many possible discrete tokens can we embed.
       Usually called the vocabulary size.
    dims (int): The dimensionality of the embeddings.
c                &   < V ^8  d   QhRS[ RS[ /# )   num_embeddingsdims)int)format__classdict__s   "o/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/mlx/nn/layers/embedding.py__annotate__Embedding.__annotate__   s     R Rs R# R    c                   < \         SV `  4        \        P                  ! ^V,          4      p\        P
                  P                  W3VR7      V n        R# )   )shapescaleN)super__init__mathsqrtmxrandomnormalweight)selfr
   r   r   	__class__s   &&& r   r   Embedding.__init__   s>    		!d(#ii&&n-C5&Qr   c                |    V P                   P                  ^ ,           RV P                   P                  ^,           2# )r   z, )r   r   )r   s   &r   _extra_reprEmbedding._extra_repr   s3    ++##A&'r$++*;*;A*>)?@@r   c                (    V P                   V,          # )Nr   r   xs   &&r   __call__Embedding.__call__   s    {{1~r   c                :    WP                   P                  ,          # )z
Call the embedding layer as a linear layer.

Use this for example when input embedding and output projection
weights are tied.
)r   Tr'   s   &&r   	as_linearEmbedding.as_linear"   s     ;;==  r   c                R   < V ^8  d   QhRS[ S[,          RS[ S[,          RS[RS[/# )r	   
group_sizebitsmodequantize_input)r   r   strbool)r   r   s   "r   r   r   +   sA     
O 
OSM
O sm
O 	
O
 
Or   c                V    V'       d   \        R4      h\        P                  ! WW#4      # )zPReturn a :obj:`QuantizedEmbedding` layer that approximates this embedding layer.z!Quantized input is not supported.)
ValueErrorr   from_embedding)r   r0   r1   r2   r3   s   &&&&&r   to_quantizedEmbedding.to_quantized+   s&     @AA!004NNr   r&   )NNaffineF)__name__
__module____qualname____firstlineno____doc__r   r#   r)   r-   r9   __static_attributes____classdictcell____classcell__)r    r   s   @@r   r   r      s8     	R R
A!
O 
O 
Or   r   )r   typingr   mlx.corecorer   mlx.nn.layers.baser   mlx.nn.layers.quantizedr   r    r   r   <module>rJ      s$       % 6*O *Or   