Hi am getting the following error for this function. Not sure what’s wrong.
Stuck on the same exercise but another error. You need to reshape a_S and a_G properly
Don’t add new lines of code. Transpose within the reshape function and the shape also doesn’t seem right
Actually I just found my mistake. It’s running now. It seems I reshaped it the correct way.
Have you executed the entire block of code?
Yes. All tests passed.
Damn. I’ve been stuck on it for hours. I’ll check my code again
What is the error that you get?
I just fixed it right now. It seems like the tf.square function isn’t working properly. I squared it using Python’s syntax (the variables in the denominator) and now the error is gone. The error was “InvalidArgumentError: cannot compute Mul as input #1(zero-based) was expected to be a double tensor but is a float tensor [Op:Mul]”
Other students have encountered the same issue as well
The error message sounds like a type mismatch. You have to be careful to use the appropriate function depending on what the inputs are. If you have a bunch of scalars, using tf.square is probably not the way to go.
I see. Thank you for clarifying the issue
I used np.square for the scalar term, but tf.square for the tensors, and it all worked. Note that m, n_H, n_W and n_C are python integers (scalar).