! * \brief Get global function by name and throw an error if it is not found. * \param name The name of the function * \return The global function * \note This function will throw an error if the function is not found. */
| 454 | * \note This function will throw an error if the function is not found. |
| 455 | */ |
| 456 | static Function GetGlobalRequired(std::string_view name) { |
| 457 | std::optional<Function> res = GetGlobal(name); |
| 458 | if (!res.has_value()) { |
| 459 | TVM_FFI_THROW(ValueError) << "Function " << name << " not found"; |
| 460 | } |
| 461 | return *res; |
| 462 | } |
| 463 | |
| 464 | /*! |
| 465 | * \brief Get global function by name |