-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Add new_empty (with dtype argument only) to torch::stable #159508
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
base: gh/mikaylagawarecki/331/base
Are you sure you want to change the base?
Add new_empty (with dtype argument only) to torch::stable #159508
Conversation
…(pending header-onlyness) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/159508
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New FailuresAs of commit ae40182 with merge base 556e2a7 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
…le::Tensor (pending header-onlyness)" needs ScalarType.h, which needs to be header-only [ghstack-poisoned]
…le::Tensor (pending header-onlyness)" needs ScalarType.h, which needs to be header-only [ghstack-poisoned]
if not has_function_variant: | ||
# Functions with both function and method variants can use the at::{*}_symint version | ||
# (e.g., narrow -> at::narrow_symint), BUT | ||
# Method-only functions with symint parameters should use at::symint:: namespace | ||
# Remove the _symint suffix since at::symint:: namespace uses the base name | ||
# (e.g., new_empty -> at::symint::new_empty<c10::SymInt>) | ||
base_name = cpp_sig.name() | ||
base_name = base_name.removesuffix("_symint") # Remove "_symint" suffix | ||
return f"at::symint::{base_name}<c10::SymInt>" | ||
|
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 is the relevant part here
Lines 717 to 739 in 6d91d6d
if Variant.function in f.variants: | |
result += f""" | |
// aten::{f.func} | |
inline {sig.decl()} {{ | |
return at::_ops::{f.func.name.unambiguous_name()}::call({exprs_str}); | |
}}""" | |
# The template function can be used from template situations | |
# where you want to switch between the symint or not version | |
# depending on a template argument | |
# | |
# NB: we ALWAYS generate this even for methods. But we put it in | |
# this header so it can take advantage of per-op headers | |
if has_symint: | |
result += f""" | |
namespace symint {{ | |
template <typename T, typename = std::enable_if_t<std::is_same_v<T, {intlike_t}>>> | |
{sig.decl(suppress_symint_suffix=True)} {{ | |
return at::_ops::{f.func.name.unambiguous_name()}::call({exprs_str}); | |
}} | |
}} | |
""" | |
return result |
needs ScalarType.h, which needs to be header-only [ghstack-poisoned]
Stack from ghstack (oldest at bottom):