Closed lbortolotti closed 7 months ago
Hi,
If you're passing a string you should pass name of the loss function, you can try either "mean_squared_error" , "mse" or "MSE"
loss: Loss function. May be a string (name of loss function)
Which is defined here https://github.com/keras-team/keras/blob/42a1535ed7d3d75711a11d295f58a2dc9a59fdae/keras/losses/losses.py#L1129
or any of the values from the exported namespace from below list.
That's what I'm doing at the moment, I opened the ticket as passing the class name as a string used to work in tf.keras, But if the new behaviour is expected, you can close the issue.
Thanks for the report, this is now fixed.
Throws
If I pass
loss = keras.losses.MeanSquaredError()
(not as a string) to compile(), it works correctly. If I forget the parentheses, I also get the error above - suggesting that the string is being parsed incorrectly.