I’m seeing grad_fns for both cases:
@torch.jit.script
def func0(x):
    return x + x + x

class SomeModule(torch.nn.Module):

    def forward(self, inp):
        # inp: has grad_fn

        @torch.jit.script
        def func1(x):
            return x + x + x

        out0 = func0(inp) # grad_fn not set
        out1 = func1(inp) # grad_fn set
        
        return out0, out1
    
model = SomeModule()
inp = torch.randn(1, requires_grad=True) + 1
print(inp.grad_fn)
# > <AddBackward0 object at 0x7f63c5c76940>
out0, out1 = model(inp)
print(out0.grad_fn)
# > <CppFunction at 0x7f63c5c76c10>
print(out1.grad_fn)
# > <AddBackward0 at 0x7f63c5c76dc0>

in 1.11.0.dev20211101. Could you update to the latest nightly binary and rerun the code?