From ff537b77ff2a8c05cf56da33d2f36c41f5ac8df8 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Mon, 29 Mar 2021 12:24:29 -0700 Subject: [PATCH] [PyTorch][easy] Move more strings in torch::class_ (#54547) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/54547 These arguments to `BuiltinOpFunction`'s ctor don't need to be copied. ghstack-source-id: 124690196 Test Plan: CI Reviewed By: SplitInfinity Differential Revision: D27277318 fbshipit-source-id: 68f1f545ca977b2e1cabc91620da31719bf81e1a --- torch/custom_class.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/torch/custom_class.h b/torch/custom_class.h index d88e863593a..f5b5b07b729 100644 --- a/torch/custom_class.h +++ b/torch/custom_class.h @@ -220,7 +220,7 @@ class class_ { detail::BoxedProxy()(stack, func); }; auto method = std::make_unique( - qualMethodName, + std::move(qualMethodName), std::move(schema), std::move(wrapped_func), std::move(doc_string)); @@ -299,9 +299,8 @@ class class_ { /// This is an unsafe method registration API added for adding custom JIT backend support via custom /// C++ classes. It is not for general purpose use. class_& _def_unboxed(std::string name, std::function func, c10::FunctionSchema schema, std::string doc_string = "") { - auto qualMethodName = qualClassName + "." + name; auto method = std::make_unique( - qualMethodName, std::move(schema), std::move(func), std::move(doc_string)); + qualClassName + "." + name, std::move(schema), std::move(func), std::move(doc_string)); classTypePtr->addMethod(method.get()); registerCustomClassMethod(std::move(method)); return *this;