Ensure that you have your model created and then you also have a dummy batch 'yhat' to pass through the forward method of your network; or anything of suitable shape.
xxxxxxxxxx
from torchviz import make_dot
make_dot(yhat, params=dict(list(model.named_parameters()))).render("rnn_torchviz", format="png")