pytorch
78022aa6 - Add more model symbolic tracing tests from torchvision (#55744)

Commit
3 years ago
Add more model symbolic tracing tests from torchvision (#55744) Summary: Fixes https://github.com/pytorch/pytorch/issues/55398 Generates tests that calls `symbolic_trace` on torchvision models and verifies the parity of outputs from eager model, `fx.GraphModule`, `jit.ScriptModule`. Test errors: GoogleNet and Inception models throw a type mismatch when scripting the traced `fx.GraphModule`. ``` Return value was annotated as having type __torch__.torchvision.models.googlenet.GoogLeNetOutputs but is actually of type Tensor: dropout = self.dropout(flatten); flatten = None fc = self.fc(dropout); dropout = None return fc ~~~~~~~~~ <--- HERE ``` Relevant type-inconsistency https://github.com/pytorch/vision/blob/512ea299d4b2d2bbac3498a75a2d8c0190cfcb39/torchvision/models/googlenet.py#L200 ``` torch.jit.unused def eager_outputs(self, x: Tensor, aux2: Tensor, aux1: Optional[Tensor]) -> GoogLeNetOutputs: if self.training and self.aux_logits: return _GoogLeNetOutputs(x, aux2, aux1) else: return x # type: ignore[return-value] ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/55744 Reviewed By: albanD Differential Revision: D27920595 Pulled By: suraj813 fbshipit-source-id: 01f6f2aef7badbde29b5162a7787b5af9398090d
Author
Parents
Loading