ValueError: only one element tensors can be converted to Python scalars - C1W3

Greetings Team,

At the tail end of this week’s assignment, I am seeing the error in the topic, after every unit test outputs ‘Success!’.

Please let me know what I need to share or discuss in order to know how to solve that part.

Thanks in advance,

Hi Omar!
Did you try using:

nparray = tensor.numpy()

I also found this on Stack Overflow:

I ran into this issue when I incorrectly implemented the get_crit_loss() function.
please make sure output should be a single tensor. (take the average of crit_fake_pred and crit_real_pred)