Repository navigation
Conversation
This PR:
- moves some of the dtype-string utilities into ScalarType.{h, cpp}
- adds a new utility to get a mapping from dtype name to the C++ dtype
- the perser now checks if the string is a dtype name; if it is then it
pulls the c++ dtype from the mapping.
Test Plan:
- new tests
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/129189
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 41003ab with merge base 54b0006 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR:
- moves some of the dtype-string utilities into ScalarType.{h, cpp}
- adds a new utility to get a mapping from dtype name to the C++ dtype
- the perser now checks if the string is a dtype name; if it is then it
pulls the c++ dtype from the mapping.
Test Plan:
- new tests
[ghstack-poisoned]
This PR:
- moves some of the dtype-string utilities into ScalarType.{h, cpp}
- adds a new utility to get a mapping from dtype name to the C++ dtype
- the perser now checks if the string is a dtype name; if it is then it
pulls the c++ dtype from the mapping.
Test Plan:
- new tests
[ghstack-poisoned]
This PR:
- moves some of the dtype-string utilities into ScalarType.{h, cpp}
- adds a new utility to get a mapping from dtype name to the C++ dtype
- the perser now checks if the string is a dtype name; if it is then it
pulls the c++ dtype from the mapping.
Test Plan:
- new tests
[ghstack-poisoned]
| return static_cast<int64_t>(at::Reduction::Mean); | ||
| } else if ("contiguous_format" == text) { | ||
| return static_cast<int64_t>(c10::MemoryFormat::Contiguous); | ||
| } else if (str2dtype.count(text) > 0) { |
There was a problem hiding this comment.
Could you clarify the implication of this change? I'm not familiar with when this code is being used.
There was a problem hiding this comment.
This function only gets called during construction of a FunctionSchema (https://www.internalfb.com/code/fbsource/[aca8f430d0152e7ffe6b24aedb8ee29808a16e3f]/fbcode/caffe2/torch/csrc/jit/frontend/function_schema_parser.cpp?lines=200%2C202%2C285%2C314%2C327): it is responsible for parsing the default values in the schema and turning them into an IValue. The implication of the change is now we support specifying the default value to be any of the keys in the str2dtype mapping (like "float64", "complex128", etc).
There was a problem hiding this comment.
Ok!
I guess none of these will be ambiguous!
There was a problem hiding this comment.
There's a bug here though, we only want to parse this as a dtype if we're sure the type is a dtype, otherwise weird things like "int x = complex128" will work... so I'll try to fix that. The bug is pre-existing though
There was a problem hiding this comment.
Yeah I guess anything that gets silently converted to int on the way down can have anything as it's default haha
This PR:
- moves some of the dtype-string utilities into ScalarType.{h, cpp}
- adds a new utility to get a mapping from dtype name to the C++ dtype
- the perser now checks if the string is a dtype name; if it is then it
pulls the c++ dtype from the mapping.
Test Plan:
- new tests
[ghstack-poisoned]
This PR:
- moves some of the dtype-string utilities into ScalarType.{h, cpp}
- adds a new utility to get a mapping from dtype name to the C++ dtype
- the perser now checks if the string is a dtype name; if it is then it
pulls the c++ dtype from the mapping.
Test Plan:
- new tests
[ghstack-poisoned]
This PR:
- moves some of the dtype-string utilities into ScalarType.{h, cpp}
- adds a new utility to get a mapping from dtype name to the C++ dtype
- the perser now checks if the string is a dtype name; if it is then it
pulls the c++ dtype from the mapping.
Test Plan:
- new tests
ghstack-source-id: ba83205
Pull Request resolved: #129189
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Stack from ghstack (oldest at bottom):
This PR:
pulls the c++ dtype from the mapping.
Test Plan: