MarisaKirisame commented on a change in pull request #6274:
URL: https://github.com/apache/incubator-tvm/pull/6274#discussion_r476763139
##########
File path: src/ir/module.cc
##########
@@ -174,46 +174,28 @@ tvm::Array<GlobalTypeVar>
IRModuleNode::GetGlobalTypeVars() const {
return tvm::Array<GlobalTypeVar>(global_type_vars);
}
-template <typename T>
-tvm::Array<T> concat(const tvm::Array<T>& l, const tvm::Array<T>& r) {
- tvm::Array<T> ret(l);
- for (const T& t : r) {
- ret.push_back(t);
- }
- return ret;
-}
-
-// helper function to run type check
-relay::Function RunTypeCheck(const IRModule& mod, const GlobalVar& var,
relay::Function f) {
- auto func = Downcast<relay::Function>(relay::DeDup(std::move(f)));
+void WarnIfMalformed(const IRModule& mod, relay::Function func) {
+ func = Downcast<relay::Function>(relay::DeDup(func));
// Type check the item before we add it to the module.
auto fv = relay::FreeVars(func);
auto ftv = relay::FreeTypeVars(func, mod);
+ // TODO(@jroesch): refactor to use diagnostic context
CHECK_EQ(fv.size(), 0) << "There are free variables: " << fv
- << " in function: " << AsText(func, false);
Review comment:
please dont remove until the diagonistic landed.
##########
File path: src/parser/parser.cc
##########
@@ -516,6 +517,9 @@ class Parser {
return Bracket(TokenType::kLCurly, TokenType::kRCurly, parser);
}
+ /*! \brief Parse a meta reference this is of the form
`meta[type_key][node_index]`. */
Review comment:
```suggestion
/*! \brief Parse a meta reference of the form
`meta[type_key][node_index]`. */
```
##########
File path: src/relay/transforms/type_infer.cc
##########
@@ -98,11 +100,11 @@ class TypeInferencer : private ExprFunctor<Type(const
Expr&)>,
public:
// constructors
- explicit TypeInferencer(IRModule mod, GlobalVar current_func)
+ explicit TypeInferencer(IRModule mod, GlobalVar current_func,
DiagnosticContext diag_ctx)
: mod_(mod),
current_func_(current_func),
- err_reporter(),
- solver_(current_func, mod, &this->err_reporter) {
+ diag_ctx(diag_ctx),
+ solver_(current_func, mod, nullptr) {
Review comment:
use optional
##########
File path: tests/python/relay/test_ir_parser.py
##########
@@ -951,5 +952,6 @@ def test_resnet_inlined_params():
tvm.ir.assert_structural_equal(mod, parsed_mod)
if __name__ == "__main__":
- import sys
- pytest.main(sys.argv)
Review comment:
[__file__]
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]