| 151 | |
| 152 | MGB_DYN_TYPE_OBJ_FINAL_IMPL(SwapIn); |
| 153 | SwapIn::SwapIn( |
| 154 | ComputingGraph& graph, const SymbolVarArray inputs, |
| 155 | const std::shared_ptr<HostTensorND>& host_data, |
| 156 | const OperatorNodeConfig& config) |
| 157 | : Super{&graph, config, "swap-in", {inputs[0].node()}}, m_host_data{host_data} { |
| 158 | // inputs[0] is the swap_out_var, and the following inputs are |
| 159 | // dependency vars |
| 160 | auto out_cn = inputs[0].node()->comp_node(); |
| 161 | |
| 162 | if (config.has_comp_node_set()) |
| 163 | out_cn = config.get_single_comp_node(); |
| 164 | mgb_assert(out_cn.valid(), "can not get output comp node"); |
| 165 | add_output(None)->dtype(host_data->dtype()); |
| 166 | |
| 167 | add_equivalence_component<ScalarHash<void*>>(host_data.get()); |
| 168 | |
| 169 | this->comp_node(out_cn); |
| 170 | for (auto& x : inputs) |
| 171 | add_input({x.node()}); |
| 172 | } |
| 173 | |
| 174 | void SwapIn::scn_do_execute() { |
| 175 | auto&& od = output(0)->dev_tensor(); |
nothing calls this directly
no test coverage detected