| 822 | } |
| 823 | |
| 824 | size_t ComputingGraphImpl::clear_device_memory() { |
| 825 | #if !MGB_BUILD_SLIM_SERVING |
| 826 | if (options().eager_evaluation) { |
| 827 | for (auto& opr : m_opr_refkeeper) { |
| 828 | if (!opr->same_type<mgb::opr::SharedDeviceTensor>() && |
| 829 | !opr->same_type<mgb::opr::ImmutableTensor>()) { |
| 830 | for (auto& var : opr->output()) { |
| 831 | if (var->mem_plan().valid()) |
| 832 | var->mem_plan().release_chunk(); |
| 833 | } |
| 834 | } |
| 835 | } |
| 836 | } |
| 837 | #endif |
| 838 | return var_node_mem_manager().clear_static_device_memory(); |
| 839 | } |
| 840 | |
| 841 | void ComputingGraphImpl::set_as_subgraph(ComputingGraph& par_graph) { |
| 842 | m_parent_graph = ComputingGraphImpl::downcast(&par_graph); |