Skip to content

Use any_type in test_out#77735

Closed
lezcano wants to merge 2 commits intogh/Lezcano/76/basefrom
gh/Lezcano/76/head
Closed

Use any_type in test_out#77735
lezcano wants to merge 2 commits intogh/Lezcano/76/basefrom
gh/Lezcano/76/head

Conversation

@lezcano
Copy link
Collaborator

@lezcano lezcano commented May 18, 2022

Stack from ghstack:

Previously, test_out used OpDTypes.none and then it pretty much
implemented OpDtypes.any_type inside. This PR changes it to use
OpDTypes. This has the advantage that the test now has a dtype, so it
can be used together with decorators that require a dtype, such as
toleranceOverride.

Previously, test_out used `OpDTypes.none` and then it pretty much
implemented `OpDtypes.any_type` inside. This PR changes it to use
`OpDTypes`. This has the advantage that the test now has a dtype, so it
can be used together with decorators that require a `dtype`, such as
`toleranceOverride`.

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented May 18, 2022

🔗 Helpful links

✅ No Failures (0 Pending)

As of commit ccc3a6f (more details on the Dr. CI page):

Expand to see more

💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

Previously, test_out used `OpDTypes.none` and then it pretty much
implemented `OpDtypes.any_type` inside. This PR changes it to use
`OpDTypes`. This has the advantage that the test now has a dtype, so it
can be used together with decorators that require a `dtype`, such as
`toleranceOverride`.

[ghstack-poisoned]
@lezcano lezcano added ciflow/all module: testing Issues related to the torch.testing module (not tests) release notes: composability release notes category topic: not user facing topic category labels May 18, 2022
# "safely" cast to
@ops(_ops_and_refs, dtypes=OpDTypes.none)
def test_out(self, device, op):
@ops(_ops_and_refs, dtypes=OpDTypes.any_one)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice

dtypes = {dtype}
break
else:
dtypes = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

When could this case trigger? Should there actually be an assertion that this never happens?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This preserves the previous behaviour (rather than skipping the test if this happens. But yeah, this could be perhaps an assert(false). We can do it in a follow-up PR

Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Cool!

Maybe make one case an assert?

facebook-github-bot pushed a commit that referenced this pull request May 20, 2022
Summary:
Previously, test_out used `OpDTypes.none` and then it pretty much
implemented `OpDtypes.any_type` inside. This PR changes it to use
`OpDTypes`. This has the advantage that the test now has a dtype, so it
can be used together with decorators that require a `dtype`, such as
`toleranceOverride`.

Pull Request resolved: #77735

Approved by: https://github.com/mruberry

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/c446f78ffd1bf2ce39a890f02325991b4441080b

Reviewed By: seemethere

Differential Revision: D36494178

Pulled By: seemethere

fbshipit-source-id: 112590f2e837eaf6861126c789929076b8692e07
@facebook-github-bot facebook-github-bot deleted the gh/Lezcano/76/head branch May 22, 2022 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed module: testing Issues related to the torch.testing module (not tests) open source release notes: composability release notes category topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants