Art_Generation_with_Neural_Style_Transfer-UN-GRADED FUNCTION: train_stepQ_C5-

Like many others I have also got this error-
Can someone suggest a final solution for this -
I tried all possible suggestions mentioned in all discussions but nothing seems to be working.
AssertionError Traceback (most recent call last)
in
5 print(J1)
6 assert type(J1) == EagerTensor, f"Wrong type {type(J1)} != {EagerTensor}"
----> 7 assert np.isclose(J1, 10221.168), f"Unexpected cost for epoch 0: {J1} != {10221.168}"
8
9 J2 = train_step(generated_image)

AssertionError: Unexpected cost for epoch 0: 2555.3056640625 != 10221.168

Hi prahladpunia,

It’s difficult to say what could be the issue on the basis of what you are reporting here. Could you for starters send me your code for train_step in a direct mail? Then I can have a look.

1 Like

I had a DM conversation with Prahlad about this already and the problem is solved. It was just an incorrect implementation of one of the function invocations in train_step.

2 Likes

Once again Thanks paul for all the help.

1 Like

Thanks - this is resolved.

I have a similar problem with the following error:

AssertionError Traceback (most recent call last)
in
5 print(J1)
6 assert type(J1) == EagerTensor, f"Wrong type {type(J1)} != {EagerTensor}"
----> 7 assert np.isclose(J1, 10221.168), f"Unexpected cost for epoch 0: {J1} != {10221.168}"
8
9 J2 = train_step(generated_image)

AssertionError: Unexpected cost for epoch 0: -128130720.0 != 10221.168

I followed the indicated instructions:

  1. In this function you must use the precomputed encoded images a_S and a_C
  2. Compute a_G as the vgg_model_outputs for the current generated image

What could be the problem?

thanks for your help
Juan

Notice that your cost value is negative. How could that happen? The costs are positive by definition. You might want to have a look at this thread for an example of one type of mistake that can cause negative cost values.

Dear Paulin, thank you very much for the information, with it I solved my problem.
Kind regards,
Juan

Hi, Juan.

That’s great news! Thanks for confirming.

Regards,
Paul