| 933 | } |
| 934 | |
| 935 | const TensorShape* StaticInferManagerImpl::do_infer_shape(Tag dest, bool allow_fail) { |
| 936 | MGB_LOCK_GUARD(m_mtx); |
| 937 | MGB_TRY { |
| 938 | auto&& container = get_tag_trait_container(dest); |
| 939 | mgb_assert( |
| 940 | container.shape, |
| 941 | "infer desc for var has not been added for infer_shape: %s", |
| 942 | cg::dump_var_info({dest}).c_str()); |
| 943 | auto ret = container.shape->infer(false, allow_fail); |
| 944 | if (!ret) { |
| 945 | mgb_assert(allow_fail); |
| 946 | return nullptr; |
| 947 | } |
| 948 | return &ret->shape(); |
| 949 | } |
| 950 | MGB_CATCH(MegBrainError & exc, { update_rethrow_exc(dest, exc); }) |
| 951 | } |
| 952 | |