Skip to content

Commit

Permalink
Use dmlc error instead (apache#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarisaKirisame authored and jroesch committed Aug 16, 2018
1 parent 2d8eeda commit 4481e48
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
7 changes: 2 additions & 5 deletions relay/src/relay/evaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ namespace relay {

using namespace tvm::runtime;

struct EvalError : std::exception {
std::string msg;
explicit EvalError(std::string msg) : msg(msg) {}

const char* what() const noexcept { return msg.c_str(); }
struct EvalError : dmlc::Error {
explicit EvalError(const std::string & msg) : Error(msg) {}
};

Evaluator::Evaluator() : env() {}
Expand Down
7 changes: 2 additions & 5 deletions relay/src/relay/forward_ad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ namespace relay {

using namespace tvm::runtime;

struct ForwardADError : std::exception {
std::string msg;
explicit ForwardADError(const std::string & msg) : msg(msg) {}

const char* what() const noexcept { return msg.c_str(); }
struct ForwardADError : dmlc::Error {
explicit ForwardADError(const std::string & msg) : Error(msg) {}
};

// todo(M.K.) use let to share intermediate code
Expand Down
7 changes: 2 additions & 5 deletions relay/src/relay/pretty_printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ namespace relay {

using namespace tvm::runtime;

struct PrintError : std::exception {
std::string msg;
explicit PrintError(std::string msg) : msg(msg) {}

const char* what() const noexcept { return msg.c_str(); }
struct PrintError : dmlc::Error {
explicit PrintError(const std::string & msg) : Error(msg) {}
};

void PrettyPrinter::PrettyPrint(const Expr & expr, ostream & os) {
Expand Down
7 changes: 2 additions & 5 deletions relay/src/relay/reverse_ad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ namespace relay {

using namespace tvm::runtime;

struct ReverseADError : std::exception {
std::string msg;
explicit ReverseADError(const std::string & msg) : msg(msg) {}

const char* what() const noexcept { return msg.c_str(); }
struct ReverseADError : dmlc::Error {
explicit ReverseADError(const std::string & msg) : Error(msg) {}
};

Expr ReverseAD::AD(const Expr& expr) { return this->operator()(expr); }
Expand Down

0 comments on commit 4481e48

Please sign in to comment.