Thank you, the original pytorch version is 0.4.1 and upgrading it to 1.9.0a it outputs the following pic

I notice that it only plots grad_fn of tensor in square node but no variable name in circle node. I tried to use named tensor like
x1 = Variable(torch.Tensor([3]), requires_grad=True)
x2 = Variable(torch.Tensor([5]), requires_grad=True)
x1.names=('x1',)
x2.names=('x2',)

a = torch.mul(x1, x2)
a.names=('a',)

y1 = torch.log(a)
y1.names=('y1',)

y2 = torch.sin(x2)
y2.names=('y2',)

w = torch.mul(y1, y2)
w.names=('w',)

This time the compiler outputs
UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at  /pytorch/c10/core/TensorImpl.h:1156.)
  x1.names=('x1',)
Traceback (most recent call last):
  File "graph.py", line 13, in <module>
    a = torch.mul(x1, x2)
RuntimeError: Error when attempting to broadcast dims ['x1'] and dims ['x2']: dim 'x1' and dim 'x2' are at the same position from the right but do not match.

Is it also possible to plot the variable name in circle node?