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

Shape Inference code for the DepthToSpace operator #903

Merged
merged 4 commits into from
Oct 12, 2021

Conversation

etiotto
Copy link
Collaborator

@etiotto etiotto commented Oct 8, 2021

The DepthToSpace operator accepts an input tensor and has a blocksize attribute. The operator reshapes the input tensor according to the blocksize attribute. Specifically, given an input tensor of dimension [N,C,H,W] (where N is the batch axis, C is the channel or depth, H is the height and W is the width) and a blocksize, the output tensor will have shape [N, C / (blocksize * blocksize), H * blocksize, W * blocksize].

This PR implements the shape inference code for the operator.

Signed-off-by: Ettore Tiotto [email protected]

@etiotto etiotto requested a review from chentong319 October 8, 2021 19:04
@etiotto etiotto self-assigned this Oct 8, 2021
Copy link
Collaborator

@AlexandreEichenberger AlexandreEichenberger left a comment

Choose a reason for hiding this comment

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

Please resolve the conflict between code and comments.

Copy link
Collaborator

@AlexandreEichenberger AlexandreEichenberger left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@AlexandreEichenberger AlexandreEichenberger left a comment

Choose a reason for hiding this comment

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

@etiotto my understanding is that both depthofspace and spaceofdepth requires the input to be of rank 4. That is a perfect example for introducing a verify method.

One can be added by adding the op in utiles/gen-onnx-mlir in the python array OpsWithVerifier.

You can look at other verifiers in OnnxOps.cpp, should be a trivial change.

You have to run the onnx script that rebuilds the table gens, see https://github.com/onnx/onnx-mlir/blob/master/docs/ImportONNXDefs.md

@etiotto
Copy link
Collaborator Author

etiotto commented Oct 11, 2021

@AlexandreEichenberger I see you have approved this PR. Can I open a separate PR to add the custom verify method for the SpaceToDepth and DepthToSpace operators ?

@AlexandreEichenberger
Copy link
Collaborator

@etiotto sure, a different PR is ok too.

@etiotto etiotto merged commit 2e1033d into master Oct 12, 2021
@etiotto etiotto deleted the DepthToSpaceShapeInference branch October 12, 2021 14:13
@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #2172 [push] Shape Inference code for... started at 10:14

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #2173 [push] Shape Inference code for... started at 09:14

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #1282 [push] Shape Inference code for... started at 10:15

@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #2172 [push] Shape Inference code for... passed after 50 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #2173 [push] Shape Inference code for... passed after 54 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #1282 [push] Shape Inference code for... passed after 1 hr 2 min

@etiotto etiotto linked an issue Oct 19, 2021 that may be closed by this pull request
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.

Support for DepthToSpace operator
4 participants