diff --git a/mindinsight/mindconverter/common/exceptions.py b/mindinsight/mindconverter/common/exceptions.py
index 7012d402..51edc5e2 100644
--- a/mindinsight/mindconverter/common/exceptions.py
+++ b/mindinsight/mindconverter/common/exceptions.py
@@ -19,7 +19,6 @@ from enum import unique, Enum
from importlib import import_module
from lib2to3.pgen2 import parse
-from treelib.exceptions import DuplicatedNodeIdError, MultipleRootError, NodeIDAbsentError
from mindinsight.mindconverter.common.log import logger as log, logger_console as log_console
@@ -36,10 +35,9 @@ class ConverterErrors(ScriptConverterErrors):
BASE_CONVERTER_FAIL = 000
GRAPH_INIT_FAIL = 100
- TREE_CREATE_FAIL = 200
- SOURCE_FILES_SAVE_FAIL = 300
- GENERATOR_FAIL = 400
- SUB_GRAPH_SEARCHING_FAIL = 500
+ SOURCE_FILES_SAVE_FAIL = 200
+ GENERATOR_FAIL = 300
+ SUB_GRAPH_SEARCHING_FAIL = 400
class ScriptNotSupport(MindInsightException):
@@ -273,30 +271,6 @@ class GraphInitError(MindConverterException):
return except_source
-class TreeCreationError(MindConverterException):
- """The tree create fail."""
-
- @unique
- class ErrCode(Enum):
- """Define error code of TreeCreationError."""
- UNKNOWN_ERROR = 0
- NODE_INPUT_MISSING = 1
- TREE_NODE_INSERT_FAIL = 2
-
- BASE_ERROR_CODE = ConverterErrors.TREE_CREATE_FAIL.value
- ERROR_CODE = ErrCode.UNKNOWN_ERROR.value
- DEFAULT_MSG = "Error occurred when create hierarchical tree."
-
- def __init__(self, msg=DEFAULT_MSG):
- super(TreeCreationError, self).__init__(user_msg=msg)
-
- @classmethod
- def raise_from(cls):
- """Raise from exceptions below."""
- except_source = NodeInputMissingError, TreeNodeInsertError, cls
- return except_source
-
-
class SourceFilesSaveError(MindConverterException):
"""The source files save fail error."""
@@ -390,35 +364,6 @@ class RuntimeIntegrityError(GraphInitError):
return RuntimeError, AttributeError, ImportError, ModuleNotFoundError, cls
-class NodeInputMissingError(TreeCreationError):
- """The node input missing error."""
- ERROR_CODE = TreeCreationError.ErrCode.NODE_INPUT_MISSING.value
-
- def __init__(self, msg):
- super(NodeInputMissingError, self).__init__(msg=msg)
-
- @classmethod
- def raise_from(cls):
- return ValueError, IndexError, KeyError, AttributeError, cls
-
-
-class TreeNodeInsertError(TreeCreationError):
- """The tree node create fail error."""
- ERROR_CODE = TreeCreationError.ErrCode.TREE_NODE_INSERT_FAIL.value
-
- def __init__(self, msg):
- super(TreeNodeInsertError, self).__init__(msg=msg)
-
- @classmethod
- def raise_from(cls):
- """Raise from exceptions below."""
- except_source = (OSError,
- DuplicatedNodeIdError,
- MultipleRootError,
- NodeIDAbsentError, cls)
- return except_source
-
-
class NodeInputTypeNotSupportError(SourceFilesSaveError):
"""The node input type NOT support error."""
ERROR_CODE = SourceFilesSaveError.ErrCode.NODE_INPUT_TYPE_NOT_SUPPORT.value
diff --git a/mindinsight/mindconverter/docs/error_code_definition.md b/mindinsight/mindconverter/docs/error_code_definition.md
index abe37f06..44e437d7 100644
--- a/mindinsight/mindconverter/docs/error_code_definition.md
+++ b/mindinsight/mindconverter/docs/error_code_definition.md
@@ -12,18 +12,15 @@
| ModelLoadingError | Fail to load the model | 1000001 | Given `--input_nodes`, `--output_nodes`, `--shape` don't match the input model; Meanwhile, the model file can not be loaded also can cause this error |
| TfRuntimeError | Fail to initialize the TF runtime | 1000002 | Resources required by TensorFlow are not available |
| RuntimeIntegrityError | Fail to locate required third party dependency | 1000003 | Caused by required third party packages are not installed |
-| TreeCreateFailError | Fail to create code hierarchical tree | 2000000 | Mainly caused by usage of `torch.nn.functional.xxx`, `torch.xxx`, `torch.Tensor.xxx` in PyTorch |
-| NodeInputMissingError | Fail to get the input node info | 2000001 | Fail to get input node info |
-| TreeNodeInsertError | Fail to insert tree node | 2000002 | Mainly caused by wrong scope name |
-| SourceFilesSaveError | Fail to generate or save converted script | 3000000 | Exception caused by 3000001~3000005 |
-| NodeInputTypeNotSupportError | Fail to recognize the input type of converted operator | 3000001 | Wrong input type set in mapper |
-| ScriptGenerationError | Fail to generate converted script | 3000002 | No left space on hard disk; Converted code is not legal; A file with the same name already exists in `--output` |
-| ReportGenerationError | Fail to generate converted script | 3000003 | No left space on hard disk; No available operator to be converted;A file with the same name already exists in `--report` |
-| CheckPointGenerationError | Fail to generate converted weight file | 3000004 | No left space on hard dist; A file with the same name already exists in `--output` |
-| WeightMapGenerationError | Fail to generate weight map file | 3000005 | No left space on hard dist; A file with the same name already exists in `--output` |
-| GeneratorError | Fail to generate code | 4000000 | Exception caused by 4000001~4000004 |
-| NodeLoadingError | Fail to load node information | 4000001 | Essential parameters are missing after conversion of a node |
-| NodeArgsTranslationError | Fail to translate the node's argument | 4000002 | Converted nodes have incorrect and conflicted information |
-| ModuleBuildError | Fail to build module instance | 4000003 | Converted nodes have incorrect and conflicted information with module |
-| CodeGenerationError | Fail to generate the code statement | 4000004 | Converted nodes have inconsistent information |
-| SubGraphSearchingError | Fail to find frequent sub-graph | 5000000 | Generally, caused by IR graph topological order error |
+| SourceFilesSaveError | Fail to generate or save converted script | 2000000 | Exception caused by 2000001~2000005 |
+| NodeInputTypeNotSupportError | Fail to recognize the input type of converted operator | 2000001 | Wrong input type set in mapper |
+| ScriptGenerationError | Fail to generate converted script | 2000002 | No left space on hard disk; Converted code is not legal; A file with the same name already exists in `--output` |
+| ReportGenerationError | Fail to generate converted script | 2000003 | No left space on hard disk; No available operator to be converted;A file with the same name already exists in `--report` |
+| CheckPointGenerationError | Fail to generate converted weight file | 2000004 | No left space on hard dist; A file with the same name already exists in `--output` |
+| WeightMapGenerationError | Fail to generate weight map file | 2000005 | No left space on hard dist; A file with the same name already exists in `--output` |
+| GeneratorError | Fail to generate code | 3000000 | Exception caused by 3000001~3000004 |
+| NodeLoadingError | Fail to load node information | 3000001 | Essential parameters are missing after conversion of a node |
+| NodeArgsTranslationError | Fail to translate the node's argument | 3000002 | Converted nodes have incorrect and conflicted information |
+| ModuleBuildError | Fail to build module instance | 3000003 | Converted nodes have incorrect and conflicted information with module |
+| CodeGenerationError | Fail to generate the code statement | 3000004 | Converted nodes have inconsistent information |
+| SubGraphSearchingError | Fail to find frequent sub-graph | 4000000 | Generally, caused by IR graph topological order error |
diff --git a/mindinsight/mindconverter/docs/error_code_definition_cn.md b/mindinsight/mindconverter/docs/error_code_definition_cn.md
index 0767f1d3..62a98334 100644
--- a/mindinsight/mindconverter/docs/error_code_definition_cn.md
+++ b/mindinsight/mindconverter/docs/error_code_definition_cn.md
@@ -11,19 +11,16 @@
| GraphInitFailError | 依据网络模型构建计算图失败 | 1000000 | 由1000001,1000002,1000003导致的计算图无法解析 |
| ModelLoadingError | 模型加载失败 | 1000001 | 给定的`--input_nodes`, `--output_nodes`, `--shape`与实际模型不符;
或模型文件存在问题导致模型无法加载 |
| TfRuntimeError | TensorFlow库执行出错 | 1000002 | TensorFlow启动申请所需资源失败导致无法正常启动,
请检查系统资源(进程数、内存、显存占用、CPU占用)是否充足 |
-| RuntimeIntegrityError | 三方依赖库不完整 | 1000003 | MindConverter运行时所需的三方依赖库未安装 |
-| TreeCreateFailError | 依据计算图构建模型树失败 | 2000000 | Tree用于生成最终代码结构,
通常由于PyTorch网络中存在`torch.nn.functional.xxx`, `torch.xxx`, `torch.Tensor.xxx`算子导致 |
-| NodeInputMissingError | 网络节点输入信息丢失 | 2000001 | 节点的输入信息丢失 |
-| TreeNodeInsertError | 树节点构建失败 | 2000002 | 由于scope name错误,无法找到该节点的父节点 |
-| SourceFilesSaveError | 生成和保存转换后的脚本文件失败 | 3000000 | 由300000至3000005导致的脚本生成保存失败 |
-| NodeInputTypeNotSupportError | 网络节点输入类型未知 | 3000001 | 映射关系中设置节点输入类型错误 |
-| ScriptGenerationError | 转换脚本生成失败 | 3000002 | 空间不足;生成的脚本不符合PEP-8规范;`--output`目录下已有同名文件存在 |
-| ReportGenerationError | 转换报告生成失败 | 3000003 | 空间不足;脚本中没有需要转换的算子;`--report`目录下已有同名文件存在 |
-| CheckPointGenerationError | 转换权重生成失败 | 3000004 | 空间不足;`--output`目录下已有同名文件存在 |
-| WeightMapGenerationError | 权重映射表生成失败 | 3000005 | 空间不足;`--output`目录下已有同名文件存在 |
-| GeneratorError | 代码生成失败 | 4000000 |由4000001至4000004引发的代码生成模块错误 |
-| NodeLoadingError | 节点读取失败 | 4000001 |转换后的节点缺少必要参数 |
-| NodeArgsTranslationError | 节点参数转换失败 | 4000002 |转换后的节点参数信息不正确 |
-| ModuleBuildError | 模块搭建失败 | 4000003 |转换后的节点信息不正确,与模块信息冲突,导致模块生成失败 |
-| CodeGenerationError | 代码生成失败 | 4000004 |转换后的节点信息前后矛盾,生成过程产生冲突 |
-| SubGraphSearchingError | 子图模式挖掘失败 | 5000000 | 通常由于模型生成对应的拓扑序错误导致 |
+| RuntimeIntegrityError | 三方依赖库不完整 | 1000003 | MindConverter运行时所需的三方依赖库未安装 | |
+| SourceFilesSaveError | 生成和保存转换后的脚本文件失败 | 2000000 | 由200000至2000005导致的脚本生成保存失败 |
+| NodeInputTypeNotSupportError | 网络节点输入类型未知 | 2000001 | 映射关系中设置节点输入类型错误 |
+| ScriptGenerationError | 转换脚本生成失败 | 2000002 | 空间不足;生成的脚本不符合PEP-8规范;`--output`目录下已有同名文件存在 |
+| ReportGenerationError | 转换报告生成失败 | 2000003 | 空间不足;脚本中没有需要转换的算子;`--report`目录下已有同名文件存在 |
+| CheckPointGenerationError | 转换权重生成失败 | 2000004 | 空间不足;`--output`目录下已有同名文件存在 |
+| WeightMapGenerationError | 权重映射表生成失败 | 2000005 | 空间不足;`--output`目录下已有同名文件存在 |
+| GeneratorError | 代码生成失败 | 3000000 |由3000001至3000004引发的代码生成模块错误 |
+| NodeLoadingError | 节点读取失败 | 3000001 |转换后的节点缺少必要参数 |
+| NodeArgsTranslationError | 节点参数转换失败 | 3000002 |转换后的节点参数信息不正确 |
+| ModuleBuildError | 模块搭建失败 | 3000003 |转换后的节点信息不正确,与模块信息冲突,导致模块生成失败 |
+| CodeGenerationError | 代码生成失败 | 3000004 |转换后的节点信息前后矛盾,生成过程产生冲突 |
+| SubGraphSearchingError | 子图模式挖掘失败 | 4000000 | 通常由于模型生成对应的拓扑序错误导致 |
diff --git a/mindinsight/mindconverter/graph_based_converter/framework.py b/mindinsight/mindconverter/graph_based_converter/framework.py
index c2343747..3ce210ab 100644
--- a/mindinsight/mindconverter/graph_based_converter/framework.py
+++ b/mindinsight/mindconverter/graph_based_converter/framework.py
@@ -28,7 +28,7 @@ from mindinsight.mindconverter.graph_based_converter.constant import FrameworkTy
from mindinsight.mindconverter.graph_based_converter.generator import batch_add_nodes
from mindinsight.mindconverter.graph_based_converter.mapper import ONNXToMindSporeMapper
from mindinsight.mindconverter.common.log import logger as log, logger_console as log_console
-from mindinsight.mindconverter.common.exceptions import GraphInitError, TreeCreationError, SourceFilesSaveError, \
+from mindinsight.mindconverter.common.exceptions import GraphInitError, SourceFilesSaveError, \
BaseConverterError, UnknownModelError, GeneratorError, TfRuntimeError, RuntimeIntegrityError, ParamMissingError, \
BadParamError
from mindinsight.mindconverter.graph_based_converter.third_party_graph import GraphFactory
@@ -160,7 +160,6 @@ def _extract_model_name(model_path):
@onnx_installation_validation
@GraphInitError.uniform_catcher()
-@TreeCreationError.uniform_catcher()
@SourceFilesSaveError.uniform_catcher()
@GeneratorError.uniform_catcher()
def graph_based_converter_onnx_to_ms(graph_path: str,
@@ -188,7 +187,6 @@ def graph_based_converter_onnx_to_ms(graph_path: str,
@tf_installation_validation
@GraphInitError.uniform_catcher()
@TfRuntimeError.uniform_catcher()
-@TreeCreationError.uniform_catcher()
@SourceFilesSaveError.uniform_catcher()
@GeneratorError.uniform_catcher()
def graph_based_converter_tf_to_ms(graph_path: str,
diff --git a/requirements.txt b/requirements.txt
index 3ab776bd..396be80f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -18,5 +18,4 @@ six>=1.12.0
Werkzeug>=1.0.0
pandas>=1.0.4
yapf>=0.30.0
-treelib>=1.6.1
grpcio>=1.27.3
\ No newline at end of file