Skip to content

guard AuxLogits call with torch.jit.is_scripting()? #3321

Open
@jerryzh168

Description

@jerryzh168

Should we guard the check:
https://github.com/pytorch/vision/blob/master/torchvision/models/inception.py#L174
with torch.jit.is_scripting()? since if self.AuxLogits is None we'll be compiling aux = self.AuxLogits(x) and jit will complain that None is used as a function.

I changed it to

       if not torch.jit.is_scripting() and aux_defined:
            aux = self.AuxLogits(x)
        else:
            aux = None

and it worked.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions