/usr/local/lib64/python3.6/site-packages/torch/fx/experimental/__pycache__
Edit: /usr/local/lib64/python3.6/site-packages/torch/fx/experimental/__pycache__/normalize.cpython-36.pyc (5001B)
3
Eg> @ s d dl Z d dlmZmZmZmZmZ d dlZd dlZd dlj Z d dlm
Z
mZ d dlm
Z
mZmZmZ d dlmZmZmZ ddlmZ G dd d e
ZG d
d deZdS ) N)AnyCallableDictTupleOptional)TransformerProxy)ArgumentTargetNode
map_aggregate)normalize_modulenormalize_functioncreate_type_hint )AnnotateTypesWithSchemac s e Zd ZdZdejjed fdd
Ze e
d fddZdee
ed
f eee
f ee
e
d
f eeee
f d fdd
Zee
ed
f eee
f d fddZ ZS )
NormalizeArgsa
Normalize arguments to Python targets. This means that
`args/kwargs` will be matched up to the module/functional's
signature and rewritten to exclusively kwargs in positional order
if `normalize_to_only_use_kwargs` is true. Also populates default
values. Does not support positional-only parameters or varargs
parameters (*args, **kwargs).
If the nodes have 'type' metadata, it will use it to disambiguate
overloads. Otherwise, it will throw an error.
Example usage:
m = torchvision.models.resnet18()
traced = torch.fx.symbolic_trace(m)
traced = NormalizeArgs(traced).transform()
T)modulenormalize_to_only_use_kwargsc s t j| i | _|| _d S )N)super__init__node_mapr )selfr r ) __class__ K/usr/local/lib64/python3.6/site-packages/torch/fx/experimental/normalize.pyr $ s zNormalizeArgs.__init__)nreturnc s | j \}}fdd tj }t|ts4ttdd |D } fdd|j D }jdkr|| jj ||||}nt
j}jdkr| j|<