# Programming Assignment: Controllable Generation

**URL:** <https://community.deeplearning.ai/t/programming-assignment-controllable-generation/540660>\
**Category:** Build Basic Generative Adversarial Networks\
**Tags:** week-module-4\
**Created:** [January 10, 2024, 11:45am UTC](https://community.deeplearning.ai/t/programming-assignment-controllable-generation/540660 "2024-01-10T11:45:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacopo\_Di\_Prima](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Jacopo\_Di\_Prima](https://community.deeplearning.ai/u/Jacopo_Di_Prima)\
**Post date:** [January 10, 2024, 11:45am UTC](https://community.deeplearning.ai/t/programming-assignment-controllable-generation/540660/1 "2024-01-10T11:45:46Z")

</div>

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’”,)

 ![Immagine 2024-01-10 124518](https://global.discourse-cdn.com/dlai/original/3X/3/7/372a5bb210ba8ff17285c1473594dcd9817cff06.png)

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [January 10, 2024, 3:42pm UTC](https://community.deeplearning.ai/t/programming-assignment-controllable-generation/540660/2 "2024-01-10T15:42:36Z")

</div>

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

```auto
Kernel -> Restart and Clear Output
Save
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.

---

<div class="post-metadata">

**Author:** ![Nydia](https://avatars.discourse-cdn.com/v4/letter/n/c57346/32.png) [@Nydia](https://community.deeplearning.ai/u/Nydia)\
**Post date:** [January 11, 2024, 1:05pm UTC](https://community.deeplearning.ai/t/programming-assignment-controllable-generation/540660/3 "2024-01-11T13:05:41Z")

</div>

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](https://stackoverflow.com/questions/60440292/runtimeerror-expected-scalar-type-long-but-found-float)
