temporarily fix advanced-setitem grad error #57737
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Bug fixes
PR changes
Others
Description
Pcard-66985
在 #57023 中,由于动态图下stride机制的支持,针对高级索引赋值的场景,移除了一次多余的set_value OP操作。即流程由
基础索引get -> index_put获取高级索引赋值结果 -> set_value回写
变为基础索引get到原tensor的view -> index_put_在view上执行inplace赋值
。上述修改在目前的动态图反向机制上存在一定问题,反向只以被赋值节点作为出发点,这导致index_put_等操作只完成了前向过程中修改值的功能,但并未参与到反向,导致部分模型无法收敛。经讨论,这个问题需要在 #57628 中修复,但由于涉及整体反向机制,需要一些时间。
因此这个PR将高级索引赋值改回此前的流程,执行一次额外的set_value赋值,保证前序操作均在反向流程中。当上述机制问题修复后再移除