pytorch
b96cc9ab - [FX][testing] Test tracing into all the standard torch.nn.functional (#55550)

Commit
3 years ago
[FX][testing] Test tracing into all the standard torch.nn.functional (#55550) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/55550 Add a test for `symbolic_trace` into `torch.nn.functional` Test against all `functional`s with `torch.Tensor` argument and `functional`s from `FUNCTIONALS_WITHOUT_ANNOTATION`. ```py FUNCTIONALS_WITHOUT_ANNOTATION = ( "adaptive_max_pool1d", "adaptive_max_pool2d", "adaptive_max_pool3d", "fractional_max_pool2d", "fractional_max_pool3d", "max_pool1d", "max_pool2d", "max_pool3d", "gaussian_nll_loss", "upsample", "upsample_bilinear", "upsample_nearest", ) ``` `UNTRACEABLE_FUNCTIONALS` lists 110 current untraceable `functional`s with expected `Error`. - `BUILT_IN_FUNC`: built-in functions or built-in methods can not be traced. - `PROXY_ITERATED`: Proxy object cannot be iterated. This can be attempted when used in a for loop or as a *args or **kwargs function argument - `LEN_ERROR`: 'len' is not supported in symbolic tracing by default. If you want this call to be recorded, please call torch.fx.wrap('len') at module scope - `ARG_TYPE_MISMATCH`: `functional()`: argument <name> (position <n>) must be <type>, not Proxy - `CONTROL_FLOW`: symbolically traced variables cannot be used as inputs to control flow - `INTERPOLATE_ARGS_CONFLICT`: When tracing the functional by calling `interpolate(input, size, scale_factor, mode="bilinear", align_corners=True)`, `ValueError("only one of size or scale_factor should be defined")` is raised Test Plan: Imported from OSS Reviewed By: jamesr66a Differential Revision: D27659367 Pulled By: ejguan fbshipit-source-id: d0d05e4d94e0b85f47e6c171a31f0d41b1387373
Author
Parents
Loading