Revert "Fix usage of forwarding references (#161094)"

This reverts commit 1ebd70d0c0d562d3be9abdee2a21906584af7d99.

Reverted https://github.com/pytorch/pytorch/pull/161094 on behalf of https://github.com/jeanschmidt due to checking if revert will fix https://github.com/pytorch/pytorch/actions/runs/17470601839/job/49621447581 ([comment](https://github.com/pytorch/pytorch/pull/161094#issuecomment-3255541480))
This commit is contained in:
PyTorch MergeBot
2025-09-04 20:35:41 +00:00
parent a3d72b09ae
commit 48bedd753d
5 changed files with 6 additions and 6 deletions

View File

@ -374,7 +374,7 @@ static inline std::vector<c10::IValue> makeStack(Inputs&&... inputs) {
template <class... Args> template <class... Args>
static inline std::vector<c10::IValue> callOpByHandle( static inline std::vector<c10::IValue> callOpByHandle(
const c10::OperatorHandle& op, const c10::OperatorHandle& op,
Args&&... args) { Args... args) {
auto stack = makeStack(std::forward<Args>(args)...); auto stack = makeStack(std::forward<Args>(args)...);
c10::Dispatcher::singleton().callBoxed(op, &stack); c10::Dispatcher::singleton().callBoxed(op, &stack);
return stack; return stack;
@ -384,7 +384,7 @@ template <class... Args>
static inline std::vector<c10::IValue> callOpByName( static inline std::vector<c10::IValue> callOpByName(
const char* func_name, const char* func_name,
const char* overload_name, const char* overload_name,
Args&&... args) { Args... args) {
const std::optional<c10::OperatorHandle> op_handle = const std::optional<c10::OperatorHandle> op_handle =
c10::Dispatcher::singleton().findSchema({func_name, overload_name}); c10::Dispatcher::singleton().findSchema({func_name, overload_name});
assert(op_handle.has_value()); assert(op_handle.has_value());

View File

@ -232,7 +232,7 @@ struct base {
return obj<T>::steal(self); return obj<T>::steal(self);
} }
template<typename ... Args> template<typename ... Args>
static obj<T> create(Args&&... args) { static obj<T> create(Args ... args) {
auto self = alloc(); auto self = alloc();
self->init(std::forward<Args>(args)...); self->init(std::forward<Args>(args)...);
return self; return self;

View File

@ -657,7 +657,7 @@ struct ThreadLocalResults {
} }
template <CallType C, EventType E, typename Ephemeral, typename... Args> template <CallType C, EventType E, typename Ephemeral, typename... Args>
TraceKey intern(Ephemeral ephemeral, Args&&... args) { TraceKey intern(Ephemeral ephemeral, Args... args) {
static_assert( static_assert(
Config<C>::event_type == E, Config<C>::event_type == E,
"ThreadLocalResults.intern called from the wrong typed context."); "ThreadLocalResults.intern called from the wrong typed context.");

View File

@ -267,7 +267,7 @@ class ExprEval {
} }
template <typename T, typename... Ts> template <typename T, typename... Ts>
T value(Ts&&... ts) { T value(Ts... ts) {
call(std::forward<Ts>(ts)...); call(std::forward<Ts>(ts)...);
return ret_value_.as<T>(); return ret_value_.as<T>();
} }

View File

@ -81,7 +81,7 @@ int filterCloseReturn(int r) {
// Wrap call to f(args) in loop to retry on EINTR // Wrap call to f(args) in loop to retry on EINTR
template <class F, class... Args> template <class F, class... Args>
ssize_t wrapNoInt(F f, Args&&... args) { ssize_t wrapNoInt(F f, Args... args) {
ssize_t r = -1; ssize_t r = -1;
do { do {
r = f(std::forward<Args>(args)...); r = f(std::forward<Args>(args)...);