C2W3_ERROR unittests.test_create_final_model(create_final_model, pre_trained_model, last_output)

I’m getting this error when I try to run the tests unittests.test_create_final_model(create_final_model, pre_trained_model, last_output).

And I don’t know what the problem is because with this I get print(type(last_output)) :
<class 'keras.src.backend.common.keras_tensor.KerasTensor'>
so last_output has the correct type.
I tried to send the assignment with this error because everything else works fine but it rejects me from that failure.
I don’t know if it’s a problem with T1 and T2 versions and the course is not updated or I forgot some parameter.

what loss did you use?

‘binary_crossentropy’

Codes removed as it is against community guidelines to post, share a screenshot of codes, link to assignment which grades your code assignment.

use tf.keras.losses.BinaryCrossentropy()

Avoid posting codes from grade cell codes and link to assignment notebook. it is against community guidelines. I only asked you what loss you are using, didn’t ask you for complete code.

Ok, I didn’t know that.
I already solved it

1 Like

@Deepti_Prasad: Specifying loss function as a string should be accepted by the unit test code (see line 337 of unittests.py)

Odds are good @cortiz is using an old version of the lab files if your suggested fix solves the issue. It’d be nice to confirm be asking the learner to refresh their workspace and try again.

the test cell seem to have still that condition probably that’s why even the 337 line elseif condition you mentioning isn’t working.

I think I remember you raising that concern earlier but they didn’t update for the unittest in the subsequent cell.

The problem was that pre_trained_model.input had type List and should be tensors. I solved it by adding some validations and parsing in a variable called “inputs” before the assignment and it worked.:white_check_mark: