Skip to content

Implement Shrink operator - #485

Merged
hariharans29 merged 22 commits into
masterfrom
shrinkOp
Mar 1, 2019
Merged

Implement Shrink operator#485
hariharans29 merged 22 commits into
masterfrom
shrinkOp

Conversation

@hariharans29

Copy link
Copy Markdown
Member

No description provided.

@hariharans29
hariharans29 requested a review from a team as a code owner February 16, 2019 03:04
Comment thread onnxruntime/core/providers/cpu/math/shrink.cc Outdated
Comment thread onnxruntime/core/providers/cpu/math/shrink.cc Outdated
Comment thread onnxruntime/core/providers/cpu/math/shrink.cc Outdated
Comment thread onnxruntime/core/providers/cpu/math/shrink.cc Outdated
@pranavsharma

Copy link
Copy Markdown
Contributor

Is this PR ready for review? If yes, you may remove the WIP from the title. Thx.

@hariharans29

Copy link
Copy Markdown
Member Author

Is this PR ready for review? If yes, you may remove the WIP from the title. Thx.

It is not ready yet. That's why I did not remove the WIP from the title. It needs some test case additions. Thanks.

@snnn

snnn commented Feb 19, 2019

Copy link
Copy Markdown
Contributor

Talked with Hari offline. It's very likely the test data is wrong. He is verifying it.

We have two ONNX test programs, one is in C++, another is in Python.
The Python one doesn't check the output tensor's shape. The C++ one(onnx_test_runner) checks it. That's why the python test passed, but the C++ test failed.

Another question is: did we check the input shape? I suspect we didn't.

@@ -312,8 +312,6 @@ int real_main(int argc, char* argv[]) {
{"scatter_without_axis", "opset 9 not supported yet"},
{"scan_sum", "opset 9 not supported yet"},
{"shrink", "opset 9 not supported yet"},

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping "shrink" test excluded because of bug in test input - onnx/onnx#1823

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create a task to fix this when #499 gets checked in to update the ONNX version?


In reply to: 258262246 [](ancestors = 258262246)

@hariharans29 hariharans29 changed the title WIP - Implement Shrink operator Implement Shrink operator Feb 19, 2019
@pranavsharma

Copy link
Copy Markdown
Contributor

The Python one doesn't check the output tensor's shape.
Is this just a bug in our implementation?

pranavsharma
pranavsharma previously approved these changes Feb 20, 2019
Comment thread onnxruntime/core/providers/cpu/nn/shrink.cc Outdated
Comment thread onnxruntime/core/providers/cpu/nn/shrink.cc Outdated
auto input = p_op_kernel_context->Input<Tensor>(0);
auto output = p_op_kernel_context->Output(0, input->Shape());

auto dtype = input->DataType();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer explicitly using 'const' and * or & with 'auto' when applicable so it's clearer what it represents.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Fixed.

template <>
Status ShrinkImpl<bool>(const Tensor* /*input*/, Tensor* /*output*/, float /*bias*/, float /*lambd*/) {
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "Input types for the Shrink operator are constrained to all numeric types only. Got bool type here.");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: limit line length to 120

https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelines is very helpful to show a vertical guideline at 120

skottmckay
skottmckay previously approved these changes Mar 1, 2019

@skottmckay skottmckay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

skottmckay
skottmckay previously approved these changes Mar 1, 2019

@skottmckay skottmckay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@skottmckay skottmckay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@hariharans29
hariharans29 merged commit a697e0b into master Mar 1, 2019
@raymondxyang
raymondxyang deleted the shrinkOp branch March 6, 2019 19:54
yuslepukhin pushed a commit that referenced this pull request Mar 17, 2026
## Describe your changes
Fix document generation issues.

## Checklist before requesting a review
- [ ] Add unit tests for this change.
- [ ] Make sure all tests can pass.
- [ ] Update documents if necessary.
- [ ] Format your code by running `pre-commit run --all-files`
- [ ] Is this a user-facing change? If yes, give a description of this
change to be included in the release notes.

## (Optional) Issue link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants