| 951 | } |
| 952 | |
| 953 | const DeviceTensorND* StaticInferManagerImpl::do_infer_value( |
| 954 | Tag dest, bool allow_fail) { |
| 955 | MGB_LOCK_GUARD(m_mtx); |
| 956 | MGB_TRY { |
| 957 | auto&& container = get_tag_trait_container(dest); |
| 958 | mgb_assert( |
| 959 | container.value, |
| 960 | "infer desc for var has not been added for infer_value: %s", |
| 961 | cg::dump_var_info({dest}).c_str()); |
| 962 | auto ret = container.value->infer(false, allow_fail); |
| 963 | if (!ret) { |
| 964 | mgb_assert(allow_fail); |
| 965 | return nullptr; |
| 966 | } |
| 967 | return &ret->value(); |
| 968 | } |
| 969 | MGB_CATCH(MegBrainError & exc, { update_rethrow_exc(dest, exc); }) |
| 970 | } |
| 971 | |