You can do that.
But if you already have a module, you can do:
mod = nn.Linear(10, 10)

jacobian(func, x) # To get the jacobian of the output wrt x

You should set create_graph=True if you want to backprop through that operation.