Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4k
[Relay][Module] Refactor the way we interface between different modules of Relay.#3906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
72ccd9ab9a5f4c175921967bde244bb19590f7880ba61d20995d1a0f2cf67028351bf63a01c4365030b7f008410a523317File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -33,6 +33,7 @@ | ||
| #include <string> | ||
| #include <vector> | ||
| #include <unordered_map> | ||
| #include <unordered_set> | ||
| namespace tvm { | ||
| namespace relay { | ||
| @@ -185,6 +186,23 @@ class ModuleNode : public RelayNode { | ||
| */ | ||
| TVM_DLL void Update(const Module& other); | ||
| /*! | ||
| * \brief Import Relay code from the file at path. | ||
| * \param path The path of the Relay code to import. | ||
| * | ||
| * \note The path resolution behavior is standard, | ||
| * if abosolute will be the absolute file, if | ||
| * relative it will be resovled against the current | ||
| * working directory. | ||
| */ | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current API mutates the module, this is a bit diverging from designs of trying to be immutable as much as possible. How about relay.Module.fromtext and relay.Module.load? | ||
| TVM_DLL void Import(const std::string& path); | ||
jroesch marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| /*! | ||
| * \brief Import Relay code from the file at path, relative to the standard library. | ||
| * \param path The path of the Relay code to import. | ||
| */ | ||
| TVM_DLL void ImportFromStd(const std::string& path); | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From users' perspective, Import and ImportFromStd seems to be a bit too similar and introduces metal overhead about choosing between them, can be combine them into one? | ||
| /*! \brief Construct a module from a standalone expression. | ||
| * | ||
| * Allows one to optionally pass a global function map and | ||
| @@ -222,6 +240,11 @@ class ModuleNode : public RelayNode { | ||
| * for convenient access | ||
| */ | ||
| std::unordered_map<int32_t, Constructor> constructor_tag_map_; | ||
| /*! \brief The files previously imported, required to ensure | ||
| importing is idempotent for each module. | ||
| */ | ||
| std::unordered_set<std::string> import_set_; | ||
| }; | ||
| struct Module : public NodeRef { | ||
| @@ -235,6 +258,12 @@ struct Module : public NodeRef { | ||
| using ContainerType = ModuleNode; | ||
| }; | ||
| /*! \brief Parse Relay source into a module. | ||
| * \param source A string of Relay source code. | ||
| * \param source_name The name of the source file. | ||
| * \return A Relay module. | ||
| */ | ||
| Module FromText(const std::string& source, const std::string& source_name); | ||
| } // namespace relay | ||
| } // namespace tvm | ||
Uh oh!
There was an error while loading. Please reload this page.