Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Incorrect ONNX export of SliceChannel #13061

Closed
MoritzMaxeiner opened this issue Oct 31, 2018 · 3 comments · Fixed by #14121
Closed

Incorrect ONNX export of SliceChannel #13061

MoritzMaxeiner opened this issue Oct 31, 2018 · 3 comments · Fixed by #14121

Comments

@MoritzMaxeiner
Copy link
Contributor

Description

The operator mapping from MXNet's SliceChannel to ONNX Split is incorrect:

elif squeeze_axis == 0 and num_outputs > 1:
        node = onnx.helper.make_node(
            "Split",
            [input_node],
            [name],
            axis=axis,
            split=[num_outputs],
            name=name,
        )
        return [node]

This means that when an array is supposed to be split into e.g. 10 evenly sized chunks (num_outputs == 10) what is exported instead is an ONNX operator that outputs one chunk of length 10, see https://github.com/onnx/onnx/blob/master/docs/Operators.md#examples-82.

It should instead read something along the lines of


    elif squeeze_axis == 0 and num_outputs > 1:
        node = onnx.helper.make_node(
            "Split",
            [input_node],
            [name + "_%s" % (i) for i in range(num_outputs)],
            axis=axis,
            name=name,
        )
        return [node]

, which will require some additional changes to consumer nodes (they'll have to select which of the "Split" node outputs they need to use).

I encountered this when I exported a model of mine to ONNX and tried to reimport it to MXNet for sanity checks, but the import failed due to the unresolved #11594

@frankfliu
Copy link
Contributor

@mxnet-label-bot [Bug, ONNX]

@anirudhacharya
Copy link
Member

@vandanavk

@vandanavk
Copy link
Contributor

PR #14121

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants