driazati:

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 also print out a model directly with
class M(nn.Module):
    def other_fn(self, x):
        return x + 10

    def forward(self, x):
        return self.other_fn(x)

m = torch.jit.script(M())
print(m._c.dump())