Art generation in neural style transfer Exercise 6 - train_step

When creating a post, please add:
*C4 Week 4 Exercise 6 - train_step
I was experimenting with my own content and style pictures. But the error below showed up in train_step. Even though earlier, when I was doing the assigned exercise, there wasn’t an error message. Can anyone explain why?

AssertionError Traceback (most recent call last)
Input In [37], in <cell line: 7>()
1 ### you cannot edit this cell
3 # You always must run the last cell before this one. You will get an error if not.
5 generated_image = tf.Variable(generated_image)
----> 7 train_step_test(train_step, generated_image)

File /tf/W4A2/, in train_step_test(target, generated_image)
87 print(J1)
88 assert type(J1) == EagerTensor, f"Wrong type {type(J1)} != {EagerTensor}"
—> 89 assert np.isclose(J1, 25629.055, rtol=0.05), f"Unexpected cost for epoch 0: {J1} != {25629.055}"
91 J2 = target(generated_image)
92 print(J2)

AssertionError: Unexpected cost for epoch 0: 27707.96875 != 25629.055

The expected cost comes from the specific test the notebook was doing.

If you change the images, do you agree that the cost may be a different value?