New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ONNX] Fix for constant folding: Slice, Added ReduceL1 and ReduceL2 #35280
Conversation
💊 CircleCI build failures summary and remediationsAs of commit 586f50f (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following build failures do not appear to be due to upstream breakages (reran 1 job to discount flakiness): pytorch_windows_vs2019_py36_cuda10.1_test1 (1/1)Step: "Test" (full log | pattern match details) <confirmed not flaky by 2 failures>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
// It needs to be adjusted (+= dim value) for aten op | ||
auto less_mask = at::lt(indices, 0); | ||
auto indices_corr = at::add(indices, inputTensorValues[0].sizes()[axis]); | ||
auto indices_masked = at::where(less_mask, indices_corr, indices); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure to understand what is happening here.
My understanding is that :
- indices contains positive and negative indices
- less mask is a mask to identify the negative indices
- indices_corr is the "corrected" indices; inputTensorValues[0].sizes()[axis] is added for all indices even if they are positive ?
- indices_masked is a mask on the corrected negative indices ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "where" op, takes values from "indices_corr" where condition (indices < 0) is true, and takes values from "indices" where condition is false. So in cases where indices < 0, we have indices += dim value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have a test covering this pass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is in test_utility_functions line 157. Index is < 0
…oof/constFoldNorm
… into neraoof/constFoldNorm
…oof/constFoldNorm
…oof/constFoldNorm
…oof/constFoldNorm
… into neraoof/constFoldNorm # Conflicts: # torch/csrc/jit/passes/onnx/constant_fold.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@houseroad Can we close this? Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@houseroad merged this pull request in 60a3e82. |
1- Added support for constant folding onnx::ReduceL1 and onnx::ReduceL2
2- Fixed constant folding for slice as onnx::Slice opset 11 supports negative axes and indices
3- Updated export of select opset 11
4- Separated test environment for test_utility_functions as environment variables could be overwritten by caffe2 quantization tests on CI