Browse Source

feat(core): move more exceptions to base exception

mgb::cg::GraphError
mgb::NumRangeChecker::Error
mgb::VarSanityCheck::Error
GitOrigin-RevId: 4d79e3629c
release-0.6
Megvii Engine Team 5 years ago
parent
commit
6137adc05a
3 changed files with 26 additions and 14 deletions
  1. +10
    -5
      src/core/include/megbrain/graph/bases.h
  2. +8
    -5
      src/plugin/include/megbrain/plugin/num_range_checker.h
  3. +8
    -4
      src/plugin/include/megbrain/plugin/var_sanity_check.h

+ 10
- 5
src/core/include/megbrain/graph/bases.h View File

@@ -48,6 +48,15 @@

namespace mgb {

class GraphError : public MegBrainError {
public:
using MegBrainError::MegBrainError;
};

} // namespace mgb

namespace mgb {

//! computing graph
namespace cg {

@@ -55,11 +64,7 @@ namespace static_infer {
struct DepElement;
};

class GraphError: public MegBrainError {
public:
using MegBrainError::MegBrainError;
};

using GraphError = mgb::GraphError;
class OperatorNodeBase;
class ComputingGraph;



+ 8
- 5
src/plugin/include/megbrain/plugin/num_range_checker.h View File

@@ -17,6 +17,13 @@
#include "megbrain/utils/thin/hash_table.h"

namespace mgb {
class NumRangeCheckerError final : public MegBrainError {
public:
using MegBrainError::MegBrainError;
};
} // namespace mgb

namespace mgb {

/*!
* \brief check that the absolute values of all numbers in a computing graph
@@ -47,11 +54,7 @@ namespace mgb {
std::string format_msg(const HostTensorND &hv, float range);

public:
class Error final: public MegBrainError {
public:
using MegBrainError::MegBrainError;
};

using Error = NumRangeCheckerError;
NumRangeChecker(cg::ComputingGraph *graph, float range);
};
}


+ 8
- 4
src/plugin/include/megbrain/plugin/var_sanity_check.h View File

@@ -21,6 +21,13 @@
#include <thread>

namespace mgb {
class VarSanityCheckError : public MegBrainError {
public:
using MegBrainError::MegBrainError;
};
} // namespace mgb

namespace mgb {

/*!
* \brief check that content of a variable does not change between when it
@@ -87,10 +94,7 @@ class VarSanityCheck final : public PluginBase {
public:
VarSanityCheck(cg::ComputingGraph* graph);

class Error : public MegBrainError {
public:
using MegBrainError::MegBrainError;
};
using Error = VarSanityCheckError;

/*!
* \brief perform basic sanity check after opr exec


Loading…
Cancel
Save