
    Χgy	                     \    d dl mZmZmZmZ d dlT d dlmZmZm	Z	m
Z
mZmZmZ d dlmZ d ZdS )    )Buffer	ParameterUninitializedBufferUninitializedParameter)*)	attention
functionalinitmodulesparallel	parameterutils)DataParallelc                 :   | i S h d}|dhz  }|                                  |k    s't          d|                                  |z
             t          |                     di                     }|D ]'}|| v r!||v rt          | d          | |         ||<   (|S )a  Return a canonicalized dict of factory kwargs.

    Given kwargs, returns a canonicalized dict of factory kwargs that can be directly passed
    to factory functions like torch.empty, or errors if unrecognized kwargs are present.

    This function makes it simple to write code like this::

        class MyModule(nn.Module):
            def __init__(self, **kwargs):
                factory_kwargs = torch.nn.factory_kwargs(kwargs)
                self.weight = Parameter(torch.empty(10, **factory_kwargs))

    Why should you use this function instead of just passing `kwargs` along directly?

    1. This function does error validation, so if there are unexpected kwargs we will
    immediately report an error, instead of deferring it to the factory call
    2. This function supports a special `factory_kwargs` argument, which can be used to
    explicitly specify a kwarg to be used for factory functions, in the event one of the
    factory kwargs conflicts with an already existing argument in the signature (e.g.
    in the signature ``def f(dtype, **kwargs)``, you can specify ``dtype`` for factory
    functions, as distinct from the dtype argument, by saying
    ``f(dtype1, factory_kwargs={"dtype": dtype2})``)
    N>   dtypedevicememory_formatfactory_kwargszunexpected kwargs z3 specified twice, in **kwargs and in factory_kwargs)keys	TypeErrordictget)kwargssimple_keysexpected_keysrks        M/var/www/html/ai-engine/env/lib/python3.11/site-packages/torch/nn/__init__.pyr   r      s    0 ~	666K#3"44M;;==M))LV[[]]]-JLLMMM 	VZZ("--..A  ;;AvvMMM   !9AaDH    N)torch.nn.parameterr   r   r   r   torch.nn.modulestorch.nnr   r	   r
   r   r   r   r   torch.nn.parallelr   r    r   r   <module>r%      s                                    ; : : : : :) ) ) ) )r   