| 945 | } |
| 946 | |
| 947 | VarNode* LoopGrad::get_grad_var(size_t inp_idx) { |
| 948 | auto&& cache = m_grad_result_cache.at(inp_idx); |
| 949 | if (!cache.first) { |
| 950 | if (static_cast<GradDesc*>(m_desc.get()) |
| 951 | ->bind_grad_var(m_fwd_loop_opr->input(inp_idx), output(inp_idx))) { |
| 952 | cache.second = output(inp_idx); |
| 953 | } else { |
| 954 | cache.second = nullptr; |
| 955 | } |
| 956 | cache.first = true; |
| 957 | } |
| 958 | return cache.second; |
| 959 | } |
| 960 | |
| 961 | void LoopGrad::scn_do_execute() { |
| 962 | mgb_assert(m_nr_scn_do_execute_run + 1 == m_fwd_loop_opr->m_nr_scn_do_execute_run); |
no test coverage detected