[Spec] DepthToSpace mode
attribute is counter-intuitive
#6069
Labels
contributions welcome
documentation
Issues related to ONNX documentation
operator
Issues related to ONNX operators
question
Questions about ONNX
spec clarification
Clarification of the ONNX spec needed
spec
Milestone
I want to discuss our spec of the DepthToSpace operator. Please help to current me if any misunderstanding. Thanks! (I don't want to mark this as a bug as it is not.)
For this operator, the
mode
attribute defaults toDCR
is counter-intuitive. IMO, there are 2 problems.The two problems
1. We should use
CRD
as the defaultDepthToSpace default mode should be compatible with the framework that defines it.
In practice, if a framework default tensor layout is
NCHW
, the DepthToSpace operator should assume to rearrange theC
dimension toHW
dimensions in anNCHW
approach (i.e.CRD
).TensorFlow is an example of default to
NHWC
tensor layout. So, for ONNX, we should useCRD
as the default.2. Our
mode
spec is confusingIn our spec:
It is not wrong, but DepthToSpace and SpaceToDepth are manipulating the
C
dimension withHW
dimensions. Using "depth, column, and then row" is confusing as it doesn't make sense if 3D image. We can argue that 3D is unsupported, but that doesn't solve the problem.Using something like
NCHW
andNHWC
is more easy to understand.What to do?
I suggest:
NCHW
andNHWC
. We can provide compatibility implicitly, and deprecate/remove legacy ones in the long term.NCHW
as the default. I am not sure if we have done this before, it's kind of tricky as it would impact the default API behavior...The text was updated successfully, but these errors were encountered: