Closed john012343210 closed 3 years ago
Quoting this answer:
make_dot expects a variable (i.e., tensor with grad_fn), not the model itself.
Try this snippet:
out = net(dummy_input) #net is your NetworkCIFAR instance, while dummy_input is a tensor
make_dot(out)
Moreover, grad_fn
is a tensor attribute, not of the model itself.
thanks @aitikgupta ! closing
I personally think that sometimes self-defined modal might not have grad_fn, so maybe could consider this more general case.
'NetworkCIFAR' object has no attribute 'grad_fn'