Critical typo: squeeze the y_pred tensor even when it’s the same rank and shape as the y_pred tensor should be == instead of !=
@rodriguesk Thank you for reporting an issue here.
Could you please elaborate the issue you are facing here ?
I was able to run the file successfully, please find the [gist](https://colab.research.google.com/gist/sushreebarsa/e3ede62d9cc1bb882d0464499ebdb158/62718.ipynb) here!
Thank you! The issue is that the code is written wrong. read the code comments and what it’s supposed to do (only squeeze when the ranks differ by exactly 1 and not squeeze for situations of equal rank). Yet the code’s if statements will squeeze whenever the ranks are equal, which is wrong.On Jan 2, 2024, at 1:09 AM, sushreebarsa ***@***.***> wrote:﻿External Email
@rodriguesk Thank you for reporting an issue here.
Could you please elaborate the issue you are facing here ?
I was able to run the file successfully, please find the gist here!
Thank you!

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***> @rodriguesk I have created a fix internally, once the changes are verified this issue will be resolved.
Thank you! it looks like the PR you made was closed as this is a fix needs to be made in the keras repo? What's the plan? @sushreebarsa I made a PR for the appropriate tf-keras repo. https://github.com/keras-team/tf-keras/pull/719
 Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62718">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62718">No</a>

https://github.com/tensorflow/tensorflow/blob/a32a1c9123a7c4fb926c1cdc3d99188a171cdfe5/tensorflow/python/keras/utils/losses_utils.py#L191

should be:
if (y_pred_rank - y_true_rank == 1) or y_pred_shape[-1] == 1:

Current behavior will squeeze the y_pred tensor even when it’s the same rank and shape as the y_pred tensor.