Skip to content

Conversation

ezyang
Copy link
Contributor

@ezyang ezyang commented May 19, 2020

Stack from ghstack:

Today, there are two equivalent representations: named_tensor_meta_ is
null, or named_tensor_meta_ is non-null but all of the dimension names
are wildcard. Let's reduce the opportunity for behavior divergence by
making the second representation illegal.

This will make it easier for me to add a dispatch key for named
tensor as I can rely on setters to always go through TensorImpl to
maintain invariants on DispatchKey.

Signed-off-by: Edward Z. Yang ezyang@fb.com

Differential Revision: D21662641

…ldcard name

Today, there are two equivalent representations: named_tensor_meta_ is
null, or named_tensor_meta_ is non-null but all of the dimension names
are wildcard.  Let's reduce the opportunity for behavior divergence by
making the second representation illegal.

This will make it easier for me to add a dispatch key for named
tensor as I can rely on setters to always go through TensorImpl to
maintain invariants on DispatchKey.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

[ghstack-poisoned]
ezyang added a commit that referenced this pull request May 19, 2020
…ldcard name

Today, there are two equivalent representations: named_tensor_meta_ is
null, or named_tensor_meta_ is non-null but all of the dimension names
are wildcard.  Let's reduce the opportunity for behavior divergence by
making the second representation illegal.

This will make it easier for me to add a dispatch key for named
tensor as I can rely on setters to always go through TensorImpl to
maintain invariants on DispatchKey.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

ghstack-source-id: 621506e
Pull Request resolved: #38725
@dr-ci
Copy link

dr-ci bot commented May 19, 2020

💊 CI failures summary and remediations

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


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

ci.pytorch.org: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 12 times.

…is a non-wildcard name"

Today, there are two equivalent representations: named_tensor_meta_ is
null, or named_tensor_meta_ is non-null but all of the dimension names
are wildcard.  Let's reduce the opportunity for behavior divergence by
making the second representation illegal.

This will make it easier for me to add a dispatch key for named
tensor as I can rely on setters to always go through TensorImpl to
maintain invariants on DispatchKey.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

[ghstack-poisoned]
Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

// non-wildcard
struct CAFFE2_API NamedTensorMeta final : public c10::NamedTensorMetaInterface {
// This enum is to remind people that the invariant on constructors is that
// the list of dimnames must have at least one non-wilddcard
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: wilddcard -> wildcard


void set_names(DimnameList new_names) {
void check_invariants() const {
// TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe delete this comment?

…is a non-wildcard name"

Today, there are two equivalent representations: named_tensor_meta_ is
null, or named_tensor_meta_ is non-null but all of the dimension names
are wildcard.  Let's reduce the opportunity for behavior divergence by
making the second representation illegal.

This will make it easier for me to add a dispatch key for named
tensor as I can rely on setters to always go through TensorImpl to
maintain invariants on DispatchKey.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

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

@ezyang merged this pull request in 6f0e536.

@facebook-github-bot facebook-github-bot deleted the gh/ezyang/759/head branch May 25, 2020 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants