Error in style-transfer.ipynb (Lesson 13)


(Sam) #1

Hello all,
Need your help
I encountered an error in style-transfer.ipynb.
This maybe because of pytorch 0.4

At cell after definition of actn_loss2, I got an error RuntimeError: element 0 of variables does not require grad and does not have a grad_fn
I overcame that error by modifying the definition of actn_loss2 as:
out = V(sf.features, requires_grad=True)…the error went away.

Now I see that the loss does not reduce:

Iteration: n_iter, loss: 4.30463981628418
Iteration: n_iter, loss: 4.30463981628418
Iteration: n_iter, loss: 4.30463981628418
Iteration: n_iter, loss: 4.30463981628418

If you have upgraded your pytorch to version 0.4 can you rerun this notebook and confirm my observation?

Any suggestions are welcome