[PyTorch] Fix missing move in Argument ctor (#64821)
authorScott Wolchok <swolchok@fb.com>
Fri, 17 Sep 2021 19:55:47 +0000 (12:55 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 17 Sep 2021 20:31:51 +0000 (13:31 -0700)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64821

Not moving adds excess refcounting overhead.
ghstack-source-id: 138304432

Test Plan: CI

Reviewed By: dhruvbird

Differential Revision: D30860720

fbshipit-source-id: de695e5cdfb1fa314b53a8bcb291343ae4eb87a5

aten/src/ATen/core/function_schema.h

index a47b855..0fef181 100644 (file)
@@ -30,7 +30,7 @@ struct Argument {
       bool kwarg_only = false,
       c10::optional<AliasInfo> alias_info = c10::nullopt)
       : name_(std::move(name)),
-        type_(type ? type : TensorType::get()),
+        type_(type ? std::move(type) : TensorType::get()),
         N_(std::move(N)),
         default_value_(std::move(default_value)),
         alias_info_(std::move(alias_info)),