pytorch
437e7d9f - codegen_backend_module() now passes correct type designators to isinstance in the generated script

Commit
3 years ago
codegen_backend_module() now passes correct type designators to isinstance in the generated script Summary: For methods returning complex (i.e. container) types, the existing code attempted to pass type designators with unsupported syntax (e.g. `Tensor[]`) into `isinstance`. Will now use the correct syntax supported by TorchScript (i.e. `List[Tensor]`). Test Plan: Unfortunately, a backend supporting methods returning container types has not yet been identified so the functionality cannot be tested end-to-end. Adding a printout of `method_ct.format(method_te)` before https://fburl.com/code/4619d12g lets inspect the difference in the generated method body, e.g.: ``` assert isinstance(_0, List[Tensor]) ``` vs ``` assert isinstance(_0, Tensor[]) ``` Reviewed By: allwu Differential Revision: D29537358 fbshipit-source-id: 3356f3c1477aa9304e1f070711f480441579414d
Author
Parents
Loading