[JIT] [Mobile] Is isinstance() supposed to work with TorchScript

As for 1), we recently changed the behavior so that functions in .code and .graph appear as function calls (previously we were inlining the function bodies). So we’re still missing the functionality to show the called functions. For now you can re-enable inlining to see the entire graph:

def other_fn(x):
    return x + 10

# Change the inlining mode before you compile
torch._C._jit_set_inline_everything_mode(True)

@torch.jit.script
def fn(x):
    return other_fn(x)

print(fn.code)
print(fn.graph)

You can track this bug in https://github.com/pytorch/pytorch/issues/29750.

1 Like