Closed fdwr closed 5 years ago
Hi @fdwr
Don't you mean:
For 4D input, the output would be 5D and axis = -3 should be treated as -3 + 5 = 2 and axis = -2 should be treated as -2 + 5 = 3 ?
(Or)
continuing from the illustrative example, I think you wanted to say "Given 2D" (not "Given 4D")
@hariharans29 Indeed :). Updated typo in-place.
Describe the bug The Lotus CPU implementation OneHot rejects negative axes except -1 (rejects -2, -3...) which is overly strict and inconsistent with the spec. It should treat negative values like the other ONNX operators (Gather, Pad, Slice) as distance from the last dimension. Although the spec doesn't explicitly state this, it is implied by the wording, and the ONNX shape inference honors any negative number.
The validation rejects valid values here: https://github.com/microsoft/onnxruntime/blob/master/onnxruntime/core/providers/cpu/tensor/onehot.h
Contrast with ONNX shape inference: https://github.com/onnx/onnx/blob/master/onnx/defs/tensor/defs.cc
System information
To Reproduce Pass axis = -3. e.g.:
Expected behavior Given 2D input (3D output), axis = -3 is treated as axis = 0, or axis = -2 is treated as axis = 1.