Question about intended behavior of is_continuous_axis for decreasing axes #22144
Unanswered
MalyalaKarthik66
asked this question in
Q&A
Replies: 1 comment
|
Hi, I looked at the behavior you described. It seems that the current implementation only treats increasing consecutive axes as continuous. The presence of axis[i + 1] - axis[i] != 1 then a sequence like [3, 2, 1, 0] will not satisfy the condition because the difference is -1. I think confirming the intended semantics would be important before changing this, because A good approach would be:
Thanks for raising this. Clarifying the expected behavior through tests would help avoid unintended changes. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi Keras team,
While contributing and reading through keras/src/utils/python_utils.py, I noticed the implementation of
is_continuous_axis.Currently, the function defines a
negative_order_flag, but the loop checks the same condition as the positive case (axis[i + 1] - axis[i] != 1). From local testing, decreasing contiguous sequences (e.g.,[3, 2, 1, 0]) currently returnFalse.I wanted to check the intended behavior here:
• Was this function meant to treat decreasing contiguous axes as continuous (as the
negative_order_flagname might suggest)?• If the condition were changed to check
!= -1, could that introduce issues for backend kernel selection paths (for example innn.pyfor normalization layers)?I have a small patch and unit tests prepared, but wanted to confirm the intended semantics before opening a PR.
Thanks!
All reactions