It is because your inputs to the forward function are in the wrong parenthesis. You are just passing the forward method into the trace function not the output. To fix it just do this
     traced = torch.trace(model.forward(example_inputs=(x, hidden)))