U
    Ic_                     @   sL   d Z ddlmZmZ ddlZddlmZ ddlmZ eee dddZdS )	z
Tools to help with tensor property propagation.

This is not intended to be imported directly; please use the exposed
functionalities in `torch.jit`.
    )AnyListN)
TensorType)Graph)graphexample_inputc                 C   s   t |  }t|dkrdS |d }t| tjjrN| dkrN|dd }t|t|ksft	dt
t||D ]`\}\}}|dkrqtt|tjt| tkrt	d| d||t|tjrt|t| qtdS )z`
    Applies properties for each tensor in the graph inputs
    using the example supplied.
    r   Nself   zHNumber of inputs in graph does not match number of inputs in the examplezInput z does not match type of example)listinputslen
isinstancetypetorchZ_CZ	ClassTypeZ	debugNameRuntimeError	enumeratezipZTensorr   ZsetTypeZcreate_from_tensor)r   r   Zgraph_inputsZin_0iZgraph_iZ	example_i r   K/tmp/pip-unpacked-wheel-gikjz4vx/torch/jit/_passes/_property_propagation.pyapply_input_props_using_example   s"    r   )	__doc__typingr   r   r   r   Ztorch._Cr   r   r   r   r   r   <module>   s
   