Programming Exercise Week 2 | Step 8 - Model all in once , Data formats of "costs"


I had passed all exercises before. Now, in ex.8 I have an issue with the “costs”. That shall be list with the costs during optimization and will be a part of the “model”.

If I check the “costs” with print I get:

Costs: [array(0.69314718), array(0.03844515), … ]

And then the final error message is:

AssertionError: Wrong length for d[‘costs’]. 20 != 1

Do I have to concert the “costs” array? In which direction I have to work? Thanks for your support in advance!


Hi @tss2ai, most probably you are hardcoding the value of num_iterations inside model when calling optimize function.