C4 - Week 3: U-Net Grader did't work

Hello,

All the block code of the Image_segmentation_Unet_v2 are “All tests passed!”. But my grade is 0/100.

I have tried this, but this didn’t help.

  1. P​ress Kernel → Restart & Clear Output
  2. P​ress File → Save and Checkpoint )

I have tried to fresh The lasted version by Help, but it didn’t help either.

T​he grader output still is:
Cell #UNQ_C2. Can’t compile the student’s code. Error: IndentationError(‘unexpected indent’, (’/tmp/student_solution_cells/cell_9.py’, 13, 4, ’ def upsampling_block(expansive_input, contractive_input, n_filters=32):\n’))

Please help me fix this. Thank you.

As I’m sure you are aware, indentation is part of the syntax of python. If everything runs successfully when you run the notebook itself, then this must mean that the notebook environment is somehow more forgiving about some aspect of indentation than the grader environment is. Perhaps it is something like mixing tabs and spaces in the indentation of a given line. It is pointing out a specific statement: the “def” statement for upsampling_block. Are you sure there isn’t an unintended space at the beginning of that line? I would also carefully re-enter the indentation on all the lines right before and right after that line by backspacing over them and carefully using only spaces to restore the correct indentation.

Let us know if that helps or not.

Update: I tried inserting a space before that def statement and it works in the notebook, but gets exactly the error message from the grader that you show. Please check carefully to make sure you didn’t insert a space before the def statement.

Thank you so much, it worked.