From 4868907cf31eac0255c1e0cb205db6d70c70fcd8 Mon Sep 17 00:00:00 2001 From: Ivan Kobzarev Date: Thu, 20 Jan 2022 09:22:21 -0800 Subject: [PATCH] [binaries] fix dump_operator_name binary (#71246) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/71246 Test Plan: Imported from OSS Reviewed By: malfet Differential Revision: D33555962 Pulled By: IvanKobzarev fbshipit-source-id: 2b386e52fa8e76c877fec5b6b15d99f7d280801f (cherry picked from commit f6d60fdff68964f77aa46ca2c51327cb66566194) --- binaries/dump_operator_names.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/binaries/dump_operator_names.cc b/binaries/dump_operator_names.cc index e0069a192d75..f77f93bf592b 100644 --- a/binaries/dump_operator_names.cc +++ b/binaries/dump_operator_names.cc @@ -29,7 +29,8 @@ void dump_opnames(const Module& m, std::unordered_set& opnames) { for (const auto& method : methods) { const auto& func = method.function(); std::cout << "function name: " << func.name() << std::endl; - torch::jit::Code code(func.graph(), ""); + auto graph = toGraphFunction(func).graph()->copy(); + torch::jit::Code code(graph, ""); for (size_t i = 0; i < code.instructions().size(); ++i) { auto ins = code.instructions()[i]; auto node = code.instructions_source()[i];