You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

vm.cc 17 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. /**
  2. * This is the C++ adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/).
  3. *
  4. * Copyright 2019 Huawei Technologies Co., Ltd
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #include "vm/vm.h"
  19. #include <algorithm>
  20. #include "vm/vmimpl.h"
  21. #include "vm/backend.h"
  22. #include "vm/transform.h"
  23. #include "pipeline/parse/data_converter.h"
  24. namespace mindspore {
  25. namespace compile {
  26. // Initialize StructPartial.
  27. // Arguments:
  28. // fn_: Callable function.
  29. // args_: Sequence of function args.
  30. // fg_: Graph of function.
  31. StructPartial::StructPartial(int fn, const VectorRef &args, const FuncGraphPtr &fg) : fn_(fn), args_(args), fg_(fg) {}
  32. std::ostream &operator<<(std::ostream &os, const StructPartial &other) {
  33. os << "partial(" << other.fn_ << ", " << other.args_.ToString() << ")";
  34. return os;
  35. }
  36. bool operator==(const StructPartial &lhs, const StructPartial &rhs) {
  37. return (lhs.fn_ == rhs.fn_ && lhs.args_ == rhs.args_ && lhs.fg_ == rhs.fg_);
  38. }
  39. StructSimuSwitch::StructSimuSwitch(const BaseRef &fn, const BaseRef &value) : fn_(fn), value_(value) {}
  40. std::ostream &operator<<(std::ostream &os, const StructSimuSwitch &other) {
  41. os << "SimulSwitch(" << other.fn_.ToString() << ", " << other.value_.ToString() << ")";
  42. return os;
  43. }
  44. bool operator==(const StructSimuSwitch &lhs, const StructSimuSwitch &rhs) {
  45. return (lhs.fn_ == rhs.fn_ && lhs.value_ == rhs.value_);
  46. }
  47. std::ostream &operator<<(std::ostream &os, const SwitchCondStatus &other) {
  48. os << "SwitchCondStatus(" << static_cast<int>(other) << ")";
  49. return os;
  50. }
  51. // Follow the specified instructions to create a VM.
  52. // Arguments:
  53. // insts_: std::vector<std::map<std::string, VectorRef>>
  54. // insts_stack_: The value stack.
  55. // retp_: The call stack.
  56. // pc_: program counter (next instruction)
  57. // sp_: stack pointer (for the value stack)
  58. FinalVM::FinalVM(const InstSet &insts, const BackendPtr &backend) : insts_(insts), pc_(0), sp_(0), backend_(backend) {
  59. MS_LOG(DEBUG) << "InstSet size:" << insts_.size();
  60. insts_stack_.emplace_back(BaseRef());
  61. retp_.push(-1);
  62. }
  63. void FinalVM::Push(const BaseRef &v) {
  64. MS_LOG(DEBUG) << "Push " << v.ToString() << " sp_:" << sp_;
  65. insts_stack_[IntToSize(sp_++)] = v;
  66. }
  67. void FinalVM::Pop(int n) {
  68. if (n > sp_) {
  69. MS_LOG(EXCEPTION) << "Invalid value of n " << n << ", it should be not more than " << sp_ - 1;
  70. }
  71. for (int i = 0; i < n; i++) {
  72. insts_stack_[IntToSize(sp_ - i - 1)] = BaseRef();
  73. }
  74. sp_ -= n;
  75. }
  76. void FinalVM::MoveStack(int nitems, int height) {
  77. if (nitems > height || height > sp_) {
  78. MS_LOG(EXCEPTION) << "MoveStack arg error: nitems=" << nitems << " height=" << height;
  79. }
  80. int n = height - nitems;
  81. int src = sp_ - height;
  82. int dst = sp_ - nitems;
  83. for (int i = 0; i < nitems; i++) {
  84. insts_stack_[IntToSize(src + i)] = insts_stack_[IntToSize(dst + i)];
  85. }
  86. Pop(n);
  87. }
  88. BaseRef FinalVM::Ref(int i) {
  89. MS_LOG(DEBUG) << "Ref i:" << i << " sp_:" << sp_;
  90. size_t sp_next = IntToSize(sp_ + i);
  91. if (sp_next < insts_stack_.size()) {
  92. if (utils::isa<PyObjectRef>(insts_stack_[sp_next])) {
  93. py::object value = utils::cast<PyObjectRef>(insts_stack_[sp_next]).object_;
  94. MS_LOG(DEBUG) << "VM ref python:" << py::str(value);
  95. return parse::data_converter::PyDataToValue(value);
  96. }
  97. MS_LOG(DEBUG) << "Ref not python :" << insts_stack_[sp_next].ToString();
  98. return insts_stack_[sp_next];
  99. }
  100. MS_LOG(EXCEPTION) << "IndexError: index(" << sp_next << ") out of range [0, " << insts_stack_.size() << ").";
  101. }
  102. void FinalVM::Pushp() { retp_.push(pc_); }
  103. void FinalVM::Popp() {
  104. if (retp_.empty()) {
  105. MS_LOG(EXCEPTION) << "Stack retp_ is empty";
  106. }
  107. pc_ = retp_.top();
  108. MS_LOG(DEBUG) << "Pop pc:" << pc_ << ", sp:" << sp_;
  109. retp_.pop();
  110. }
  111. void FinalVM::Pushsp() { retsp_.push(sp_); }
  112. void FinalVM::Popsp() {
  113. int sp = retsp_.top();
  114. MS_LOG(DEBUG) << "Current sp:" << sp_ << ", before sp:" << sp << ", " << sp_ - sp;
  115. if (sp_ >= sp) {
  116. Pop(sp_ - sp + 1);
  117. retsp_.pop();
  118. } else {
  119. MS_LOG(EXCEPTION) << "Stack point sp_:" << sp << " must biger than sp:" << sp_;
  120. }
  121. }
  122. void FinalVM::DoJmp(const BaseRef &jmp_orig) {
  123. MS_LOG(DEBUG) << "Start";
  124. BaseRef jmp = jmp_orig;
  125. if (backend_->simu_flag()) {
  126. if (utils::isa<StructSimuSwitch>(jmp)) { // need to inherit from Base
  127. MS_LOG(DEBUG) << "Start jump StructSwitch";
  128. auto simu_value = utils::cast<std::shared_ptr<StructSimuSwitch>>(jmp);
  129. jmp = simu_value->fn_;
  130. backend_->set_curr_switch(simu_value->value_);
  131. }
  132. }
  133. if (utils::isa<StructPartial>(jmp)) { // need to inherit from Base
  134. MS_LOG(DEBUG) << "Start jump StructPartial";
  135. auto new_jmp = utils::cast<std::shared_ptr<StructPartial>>(jmp);
  136. auto args = new_jmp->args_;
  137. InstPadStack(VectorRef(std::vector<BaseRef>{static_cast<int>(args.size())}));
  138. auto iter = args.rbegin();
  139. for (; iter != args.rend(); ++iter) {
  140. Push(*iter);
  141. }
  142. pc_ = new_jmp->fn_;
  143. return;
  144. }
  145. if (!utils::isa<int>(jmp)) {
  146. MS_LOG(EXCEPTION) << "Jmp inst should be a int";
  147. }
  148. pc_ = utils::cast<int>(jmp);
  149. MS_LOG(DEBUG) << "End do jump pc_:" << pc_;
  150. }
  151. BaseRef FinalVM::Eval(const VectorRef &args) {
  152. MS_LOG(DEBUG) << "Start: " << args.size();
  153. insts_stack_.clear();
  154. insts_stack_.resize(args.size());
  155. std::stack<int>().swap(retp_);
  156. retp_.push(-1);
  157. pc_ = 0;
  158. sp_ = 0;
  159. auto riter = args.rbegin();
  160. for (; riter != args.rend(); ++riter) {
  161. if (utils::isa<PyObjectRef>(*riter)) {
  162. PyObjectRef py_ref = utils::cast<PyObjectRef>(*riter);
  163. py::object value = py_ref.object_;
  164. if (py::isinstance<py::bool_>(value)) {
  165. auto a = py::cast<bool>(value);
  166. Push(static_cast<int>(a));
  167. continue;
  168. }
  169. }
  170. Push(*riter);
  171. }
  172. while (pc_ >= 0) {
  173. auto inst = insts_[IntToSize(pc_)];
  174. MS_LOG(DEBUG) << "Loop " << insts_.size() << ", pc:" << pc_ << ", inst:" << inst_str[inst.first];
  175. ++pc_;
  176. auto iter = inst_function_map.find(inst.first);
  177. if (iter != inst_function_map.end()) {
  178. iter->second(inst.second);
  179. } else {
  180. MS_LOG(EXCEPTION) << "Unknown instruction {" << inst_str[inst.first] << "}";
  181. }
  182. }
  183. MS_LOG(DEBUG) << "End";
  184. return insts_stack_[0];
  185. }
  186. void FinalVM::InstCall(const VectorRef &args) {
  187. MS_LOG(DEBUG) << "Start";
  188. const size_t args_size = 1;
  189. if (args.size() != args_size) {
  190. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " parameter, while the input size is " << args.size()
  191. << ".";
  192. return;
  193. }
  194. int jmp = utils::cast<int>(args[0]);
  195. MS_LOG(DEBUG) << "Call pushp:" << pc_ << ", jmp:" << jmp << ", sp:" << sp_;
  196. Pushp();
  197. DoJmp(Ref(jmp));
  198. MS_LOG(DEBUG) << "Instcall end sp :" << sp_;
  199. }
  200. void FinalVM::InstTailCall(const VectorRef &args) {
  201. MS_LOG(DEBUG) << "Start";
  202. const size_t args_size = 3;
  203. if (args.size() != args_size) {
  204. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " parameters, while the input size is " << args.size()
  205. << ".";
  206. return;
  207. }
  208. int jmp = utils::cast<int>(args[0]);
  209. int height = utils::cast<int>(args[1]);
  210. int nargs = utils::cast<int>(args[2]);
  211. auto new_jmp = Ref(jmp);
  212. MoveStack(nargs, height);
  213. MS_LOG(DEBUG) << "TailCall pushp:" << pc_ << ", jmp:" << jmp;
  214. DoJmp(new_jmp);
  215. MS_LOG(DEBUG) << "End";
  216. }
  217. void FinalVM::InstSwitchReturn(const VectorRef &args) {
  218. MS_LOG(DEBUG) << "Start";
  219. if (args.size() != 1) {
  220. MS_LOG(ERROR) << __FUNCTION__ << " requires one parameter, while the input size is " << args.size() << ".";
  221. return;
  222. }
  223. Pop(1);
  224. Popsp();
  225. }
  226. void FinalVM::InstReturn(const VectorRef &args) {
  227. MS_LOG(DEBUG) << "Start";
  228. const size_t args_size = 2;
  229. if (args.size() != args_size) {
  230. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " parameters, while the input size is " << args.size()
  231. << ".";
  232. return;
  233. }
  234. int rpos = utils::cast<int>(args[0]);
  235. int height = utils::cast<int>(args[1]);
  236. auto rv = Ref(rpos);
  237. if (backend_->simu_flag() && backend_->is_switch_call()) {
  238. backend_->SetSwitchGraph();
  239. }
  240. Pop(height);
  241. Push(rv);
  242. Popp();
  243. MS_LOG(DEBUG) << "End";
  244. }
  245. void FinalVM::InstSimuPartial(const VectorRef &args) {
  246. const size_t args_size = 2;
  247. if (args.size() < args_size) {
  248. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " or more parameters, while the input size is "
  249. << args.size() << ".";
  250. return;
  251. }
  252. auto &node = args[0];
  253. if (!utils::isa<FuncGraphPtr>(node)) {
  254. MS_LOG(ERROR) << "The type of 1st input of node must be FuncGraph";
  255. return;
  256. }
  257. auto fg = utils::cast<FuncGraphPtr>(node);
  258. int fn_ = utils::cast<int>(args[1]);
  259. auto fn = utils::cast<int>(Ref(fn_));
  260. MS_LOG(DEBUG) << "Partial argssize:" << args.size();
  261. std::vector<BaseRef> outs(args.size() - 2);
  262. (void)std::transform(args.begin() + 2, args.end(), outs.begin(),
  263. [&, this](const BaseRef &a) { return Ref(utils::cast<int>(a)); });
  264. Push(std::make_shared<StructPartial>(fn, VectorRef(outs), fg));
  265. }
  266. void FinalVM::InstRealPartial(const VectorRef &args) {
  267. const size_t args_size = 1;
  268. if (args.size() < args_size) {
  269. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " or more parameters, while the input size is "
  270. << args.size() << ".";
  271. return;
  272. }
  273. int fn_ = utils::cast<int>(args[0]);
  274. auto fn = utils::cast<int>(Ref(fn_));
  275. MS_LOG(DEBUG) << "Partial argssize:" << args.size();
  276. std::vector<BaseRef> outs(args.size() - 1);
  277. (void)std::transform(args.begin() + 1, args.end(), outs.begin(),
  278. [&, this](const BaseRef &a) { return Ref(utils::cast<int>(a)); });
  279. Push(std::make_shared<StructPartial>(fn, VectorRef(outs)));
  280. }
  281. void FinalVM::InstPartial(const VectorRef &args) {
  282. MS_LOG(DEBUG) << "Start";
  283. if (backend_->is_multi_graph_sink()) {
  284. InstSimuPartial(args);
  285. } else {
  286. InstRealPartial(args);
  287. }
  288. MS_LOG(DEBUG) << "End";
  289. }
  290. void FinalVM::InstSimuSwitch(const VectorRef &args) {
  291. const size_t args_size = 4;
  292. if (args.size() != args_size) {
  293. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " parameters, while the input size is " << args.size()
  294. << ".";
  295. return;
  296. }
  297. bool cond = utils::cast<bool>(args[0]);
  298. int cond_node = utils::cast<int>(args[1]);
  299. int vtrue = utils::cast<int>(args[2]);
  300. int vfalse = utils::cast<int>(args[3]);
  301. MS_LOG(DEBUG) << "Simu switch cond:" << cond;
  302. BaseRef c = Ref(cond_node);
  303. bool bool_value = cond;
  304. SwitchCondStatus cond_stat = backend_->SetSimuCond(c, bool_value);
  305. if (cond_stat == kCondAlreadyRun) {
  306. MS_LOG(DEBUG) << "switch alreay run bool while true jmp";
  307. BaseRef jmp = Ref(vtrue);
  308. if (utils::isa<StructPartial>(jmp)) {
  309. auto new_jmp = utils::cast<std::shared_ptr<StructPartial>>(jmp);
  310. backend_->RecallGraphInput(new_jmp->fg_, new_jmp->args_, c);
  311. }
  312. cond_jmp_[c] = Ref(vfalse);
  313. Push(static_cast<int>(cond_stat));
  314. Popp();
  315. backend_->SetSwitchActive(c, bool_value);
  316. return;
  317. }
  318. if (bool_value) {
  319. Push(std::make_shared<StructSimuSwitch>(Ref(vtrue), c));
  320. Pushsp();
  321. } else {
  322. MergeJmpArgs(Ref(vfalse), c);
  323. Push(std::make_shared<StructSimuSwitch>(Ref(vfalse), c));
  324. }
  325. }
  326. void FinalVM::MergeJmpArgs(const BaseRef &jmp, const BaseRef &c) {
  327. auto iter = cond_jmp_.find(c);
  328. if (iter == cond_jmp_.end()) {
  329. return;
  330. }
  331. auto old_jmp = utils::cast<std::shared_ptr<StructPartial>>(iter->second);
  332. auto new_jmp = utils::cast<std::shared_ptr<StructPartial>>(jmp);
  333. auto &old_args = old_jmp->args_;
  334. auto &new_args = new_jmp->args_;
  335. for (size_t i = 0; i < new_args.size(); ++i) {
  336. auto &old_arg = old_args[i];
  337. auto &new_arg = new_args[i];
  338. if (utils::isa<VectorRef>(old_arg)) {
  339. auto old_vec_ref = utils::cast<VectorRef>(old_arg);
  340. if (utils::isa<VectorRef>(new_arg)) {
  341. auto new_vec_ref = utils::cast<VectorRef>(new_arg);
  342. std::copy(new_vec_ref.begin(), new_vec_ref.end(), std::back_inserter(old_vec_ref));
  343. }
  344. new_arg = old_vec_ref;
  345. } else if (utils::isa<VectorRef>(new_arg)) {
  346. auto new_vec_ref = utils::cast<VectorRef>(new_arg);
  347. new_vec_ref.push_back(old_arg);
  348. new_arg = new_vec_ref;
  349. } else {
  350. new_arg = VectorRef({new_arg, old_arg});
  351. }
  352. }
  353. }
  354. void FinalVM::InstRealSwitch(const VectorRef &args) {
  355. const size_t args_size = 3;
  356. if (args.size() != args_size) {
  357. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " parameters, while the input size is " << args.size()
  358. << ".";
  359. return;
  360. }
  361. int cond = utils::cast<int>(args[0]);
  362. int vtrue = utils::cast<int>(args[1]);
  363. int vfalse = utils::cast<int>(args[2]);
  364. BaseRef c = Ref(cond);
  365. MS_LOG(DEBUG) << vtrue << " false:" << vfalse << " InstSwitch: " << c.ToString();
  366. bool bool_value = false;
  367. if (backend_->GetCond(c, &bool_value)) {
  368. MS_LOG(DEBUG) << "Cond:" << bool_value;
  369. if (bool_value) {
  370. Push(Ref(vtrue));
  371. } else {
  372. Push(Ref(vfalse));
  373. }
  374. } else {
  375. MS_LOG(EXCEPTION) << "Not supported type to be casted to bool";
  376. }
  377. }
  378. void FinalVM::InstSwitch(const VectorRef &args) {
  379. MS_LOG(DEBUG) << "Start";
  380. if (backend_->is_multi_graph_sink()) {
  381. InstSimuSwitch(args);
  382. } else {
  383. InstRealSwitch(args);
  384. }
  385. MS_LOG(DEBUG) << "End";
  386. }
  387. void FinalVM::InstTuple(const VectorRef &args) {
  388. MS_LOG(DEBUG) << "Start";
  389. VectorRef tuple;
  390. auto iter = args.begin();
  391. for (; iter != args.end(); ++iter) {
  392. auto a = utils::cast<int>(*iter);
  393. tuple.push_back(Ref(a));
  394. }
  395. Push(tuple);
  396. MS_LOG(DEBUG) << "End";
  397. }
  398. void FinalVM::InstPush(const VectorRef &args) {
  399. MS_LOG(DEBUG) << "Start";
  400. const size_t args_size = 1;
  401. if (args.size() != args_size) {
  402. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " parameter, while the input size is " << args.size()
  403. << ".";
  404. return;
  405. }
  406. auto v = args[0];
  407. Push(v);
  408. MS_LOG(DEBUG) << "End";
  409. }
  410. void FinalVM::InstInput(const VectorRef &args) {
  411. MS_LOG(DEBUG) << "Start";
  412. const size_t args_size = 1;
  413. if (args.size() != args_size) {
  414. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " parameter, while the input size is " << args.size()
  415. << ".";
  416. return;
  417. }
  418. int rpos = utils::cast<int>(args[0]);
  419. Push(Ref(rpos));
  420. MS_LOG(DEBUG) << "End";
  421. }
  422. void FinalVM::InstPadStack(const VectorRef &args) {
  423. MS_LOG(DEBUG) << "Start";
  424. const size_t args_size = 1;
  425. if (args.size() != args_size) {
  426. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " parameter, while the input size is " << args.size()
  427. << ".";
  428. return;
  429. }
  430. int sz = utils::cast<int>(args[0]);
  431. MS_LOG(DEBUG) << insts_stack_.size() << " need padstack " << sz << " sp_ " << sp_;
  432. size_t stack_size = insts_stack_.size();
  433. int need = sz - (static_cast<int>(stack_size) - sp_);
  434. if (need > 0) {
  435. MS_LOG(DEBUG) << "InstPadStack resize: size:" << insts_stack_.size() << " need pad:" << need;
  436. insts_stack_.resize(stack_size + IntToSize(need));
  437. }
  438. MS_LOG(DEBUG) << "End";
  439. }
  440. void FinalVM::InstExternal(const VectorRef &args) {
  441. MS_LOG(DEBUG) << "Start:" << args.size();
  442. if (args.empty()) {
  443. MS_LOG(EXCEPTION) << "Args is empty!";
  444. }
  445. VectorRef tuple;
  446. RunFunctionRef run_ref = utils::cast<RunFunctionRef>(args[0]);
  447. compile::RunFuncPtr fn = run_ref.func_;
  448. if (backend_->simu_flag()) {
  449. MS_LOG(DEBUG) << "Simu run";
  450. if (args.size() == 1) {
  451. MS_LOG(EXCEPTION) << "The number of args should be greater than 1, but got 1";
  452. }
  453. auto simu_run_ref = utils::cast<RunFunctionRef>(args[1]);
  454. fn = simu_run_ref.func_;
  455. }
  456. for (size_t i = 2; i < args.size(); ++i) {
  457. auto index = utils::cast<int>(args[i]);
  458. tuple.push_back(Ref(index));
  459. }
  460. if (!fn) {
  461. MS_LOG(EXCEPTION) << "Function not callable";
  462. }
  463. auto outs = (*fn)(tuple);
  464. MS_LOG(DEBUG) << "'fn' out size:" << outs.size();
  465. for (auto &o : outs) {
  466. MS_LOG(DEBUG) << "InstExternal value:" << o.ToString();
  467. Push(o);
  468. }
  469. MS_LOG(DEBUG) << "End";
  470. }
  471. void FinalVM::InstPushPrim(const VectorRef &args) {
  472. MS_LOG(DEBUG) << "Start: " << args.size();
  473. const size_t args_size = 2;
  474. if (args.size() < args_size) {
  475. MS_LOG(ERROR) << __FUNCTION__ << " requires " << args_size << " or more parameters, while the input size is "
  476. << args.size() << ".";
  477. return;
  478. }
  479. VectorRef tuple;
  480. auto prim = utils::cast<PrimitivePtr>(args[0]);
  481. for (size_t i = 1; i < args.size(); ++i) {
  482. auto index = utils::cast<int>(args[1]);
  483. tuple.push_back(Ref(index));
  484. }
  485. auto outs = RunOperation(prim, tuple);
  486. Push(outs);
  487. MS_LOG(DEBUG) << "End";
  488. }
  489. } // namespace compile
  490. } // namespace mindspore