Skip to content
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

Inconsistency of Squeeze spec between Ort and ONNX #349

Closed
xkszltl opened this issue Jan 17, 2019 · 2 comments
Closed

Inconsistency of Squeeze spec between Ort and ONNX #349

xkszltl opened this issue Jan 17, 2019 · 2 comments

Comments

@xkszltl
Copy link
Contributor

xkszltl commented Jan 17, 2019

Describe the bug

Ort uses 0-based index for axes in Squeeze but looks like ONNX says it should be 1-based.
https://github.com/onnx/onnx/blob/master/docs/Operators.md#Squeeze

axes : list of ints
List of positive integers, indicate the dimensions to squeeze.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Win10
  • ONNX Runtime installed from (source or binary): source
  • ONNX Runtime version: master
  • Python version: 3.7.2
  • GCC/Compiler version (if compiling from source): VS2017
@jywu-msft
Copy link
Member

jywu-msft commented Jan 21, 2019

it's a technical error in the description then. it should be 0-based index for axes.
The example in the spec https://github.com/onnx/onnx/blob/master/docs/Operators.md#examples-97
even uses a 0 axis

node = onnx.helper.make_node(
'Squeeze',
inputs=['x'],
outputs=['y'],
axes=[0],
)
x = np.random.randn(1, 3, 4, 5).astype(np.float32)
y = np.squeeze(x, axis=0)

expect(node, inputs=[x], outputs=[y],
name='test_squeeze')

Given onnx is an interchange format between frameworks and caffe2, tf, pytorch etc. use 0-based index, it wouldn't make sense for onnx to use 1-based.

@xkszltl
Copy link
Contributor Author

xkszltl commented Jan 21, 2019

Forward to ONNX repo: onnx/onnx#1755

@xkszltl xkszltl closed this as completed Jan 21, 2019
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

No branches or pull requests

2 participants