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

Fix GroupNorm dynamic input #1922

Merged
merged 2 commits into from
Jul 31, 2023
Merged

Conversation

sercand
Copy link
Contributor

@sercand sercand commented Jul 26, 2023

Fixes #1303 for GroupNorm only.

Added a test case for this issue. Without this patch the test fails with

cls = <class 'coremltools.converters.mil.mil.builder.Builder'>, val = [6, 1, 1, is28, is29], name = 'reshape_14_shape', before_op = None

    @classmethod
    def _add_const(cls, val, name, before_op):
        if not is_python_value(val):
>           raise ValueError("Cannot add const {}".format(val))
E           ValueError: Cannot add const [6, 1, 1, is28, is29]

coremltools/converters/mil/mil/builder.py:76: ValueError

Signed-off-by: Sercan Degirmenci <[email protected]>
@sercand sercand changed the title fix groupnorm dynamic input Fix GroupNorm dynamic input Jul 26, 2023
@YifanShenSZ
Copy link
Collaborator

Thank @sercand for the great PR! This PR inspires me of the culprit to issues #1303 and #1921. I opened issue #1926 to see if we can have a general solution to all of them

which is suggessed on PR review

Signed-off-by: Sercan Degirmenci <[email protected]>
@YifanShenSZ
Copy link
Collaborator

@YifanShenSZ
Copy link
Collaborator

Got an CI error unrelated to this PR, same as the one in PR #1923

Copy link
Collaborator

@jakesabathia2 jakesabathia2 left a comment

Choose a reason for hiding this comment

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

@sercand Thanks for your contribution to coremltools!

@jakesabathia2 jakesabathia2 merged commit ccd1231 into apple:main Jul 31, 2023
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.

[Urgent] PyTorch GroupNorm and Meshgrid conversion fails for dynamic input
4 participants