Programming Assignment: Controllable Generation

I get this error, i dont get were it fails

Cell #7. Can’t compile the student’s code. Error: RuntimeError(“Expected object of scalar type Long but got scalar type Float for sequence element 1 in sequence argument at position #1 ‘tensors’”,)

That code looks correct to me. One thing to try to make sure everything is in a consistent state is:

Kernel -> Restart and Clear Output
Cell -> Run All

Then check and see if you still get that exception. Maybe you changed the code and did not click “Shift-Enter” on the actual function cell, so it is actually running the previous version of your code.

The other question is whether you see this exception when you run the notebook or from the grader.

Also note that you tagged this as week3, but it’s actually week4. I fixed the tag for you using the little “edit pencil” on the title.

Probably again this has to do with the PyTorch version. You could also try to cast as in python - RuntimeError: expected scalar type Long but found Float - Stack Overflow