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
Add dict()
constructor
#51934
Add dict()
constructor
#51934
Conversation
[ghstack-poisoned]
ghstack-source-id: 4d210ba5c7e8a014406d8807af4bf8db621517bc Pull Request resolved: #51934
💊 CI failures summary and remediationsAs of commit 2d5d0f0 (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages: pytorch_xla_linux_bionic_py3_6_clang9_test (1/1)Step: "Run tests" (full log | diagnosis details | 🔁 rerun)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 🚀 🚀 🚀
} | ||
default: | ||
TORCH_INTERNAL_ASSERT(false, "unknown special form: ", form); | ||
if (!apply.inputs().empty() && apply.inputs()[0].kind() == TK_DICT_LITERAL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, we should get rid of the special empty handling - we're not handling dicts/mappings in general, and dict([])
will work without the special case.
auto name = StringLiteral::create(kwarg.range(), kwarg.name().name()); | ||
auto k = emitExpr(name); | ||
auto v = emitExpr(kwarg.value()); | ||
NamedValue input_k = NamedValue(kwarg.range(), "", k); | ||
NamedValue input_v = NamedValue(kwarg.range(), "", v); | ||
emitBuiltinCall( | ||
kwarg.range(), *graph, aten::_set_item, {self, input_k, input_v}, {}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is very similar to 3076-3083, you might be able to factor it out to a helper lambda or function
[ghstack-poisoned]
Differential Revision: [D26418199](https://our.internmc.facebook.com/intern/diff/D26418199) [ghstack-poisoned]
Differential Revision: [D26418199](https://our.internmc.facebook.com/intern/diff/D26418199) [ghstack-poisoned]
ghstack-source-id: 0b55245f9cb6e71e13f3bd9b4614eff7a4b89b09 Pull Request resolved: #51934
Summary: Pull Request resolved: pytorch#51934 Test Plan: Imported from OSS Reviewed By: pbelevich Differential Revision: D26418199 Pulled By: ansley fbshipit-source-id: 524f6d9d29ee1fa1b7c5e80ada82e577f47089dc
Stack from ghstack:
dict()
constructor #51934 Adddict()
constructorDifferential Revision: D26418199