已开启
refactor: HostCPU pass统一使用OpTypeUtils判断类型 #1
gentle-knight创建于 7月30日
refactor: HostCPU pass统一使用OpTypeUtils判断类型 #1
已开启
共 1 个文件变更+5-5
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | + | ||
| 14 | 15 | ||
| 15 | 16 | ||
| 16 | 17 | ||
| @@ -58,12 +59,11 @@ bool IsExecOnDevice(const OpDescPtr &op_desc) { | |||
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | bool IsConstOp(const OpDescPtr &op_desc) { | 61 | bool IsConstOp(const OpDescPtr &op_desc) { |
| 61 | - return (strcmp(op_desc->GetTypePtr(), CONSTANT) == 0) || (strcmp(op_desc->GetTypePtr(), CONSTANTOP) == 0); | 62 | + return OpTypeUtils::IsConstNode(op_desc->GetType()); |
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | bool IsHostModelInputType(const OpDescPtr &op_desc) { | 65 | bool IsHostModelInputType(const OpDescPtr &op_desc) { |
| 65 | - const auto type = op_desc->GetTypePtr(); | 66 | + return OpTypeUtils::IsDataNode(op_desc->GetType()); |
| 66 | - return (strcmp(type, DATA) == 0); | ||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | bool IsHostInputAnchor(const OpDescPtr &op_desc) { | 69 | bool IsHostInputAnchor(const OpDescPtr &op_desc) { |
| @@ -294,7 +294,7 @@ Status HostcpuEngineUpdatePass::FindHostDataOfSubgraph(const ComputeGraphPtr &gr | |||
| 294 | } | 294 | } |
| 295 | for (const auto &node : graph->GetDirectNode()) { | 295 | for (const auto &node : graph->GetDirectNode()) { |
| 296 | GE_CHECK_NOTNULL(node); | 296 | GE_CHECK_NOTNULL(node); |
| 297 | - if (strcmp(node->GetTypePtr(), DATA) == 0) { | 297 | + if (OpTypeUtils::IsDataNode(node->GetType())) { |
| 298 | NodePtr in_node = GetParentNode(node); | 298 | NodePtr in_node = GetParentNode(node); |
| 299 | if ((in_node != nullptr) && IsExecOnHost(in_node)) { | 299 | if ((in_node != nullptr) && IsExecOnHost(in_node)) { |
| 300 | if (host_exe_ops_.count(node) > 0U) { | 300 | if (host_exe_ops_.count(node) > 0U) { |
| @@ -313,7 +313,7 @@ Status HostcpuEngineUpdatePass::FindHostDataOfSubgraph(const ComputeGraphPtr &gr | |||
| 313 | Status HostcpuEngineUpdatePass::FindHostDataOfPartitionCall(const ComputeGraphPtr &graph, std::deque<NodePtr> &q) { | 313 | Status HostcpuEngineUpdatePass::FindHostDataOfPartitionCall(const ComputeGraphPtr &graph, std::deque<NodePtr> &q) { |
| 314 | for (const auto &node : graph->GetDirectNode()) { | 314 | for (const auto &node : graph->GetDirectNode()) { |
| 315 | GE_CHECK_NOTNULL(node); | 315 | GE_CHECK_NOTNULL(node); |
| 316 | - if (strcmp(node->GetTypePtr(), DATA) == 0) { | 316 | + if (OpTypeUtils::IsDataNode(node->GetType())) { |
| 317 | NodePtr in_node = nullptr; | 317 | NodePtr in_node = nullptr; |
| 318 | GE_ASSERT_SUCCESS(NodeUtils::GetInNodeCrossPartionedCallNode(node, kDataInputIndex, in_node)); | 318 | GE_ASSERT_SUCCESS(NodeUtils::GetInNodeCrossPartionedCallNode(node, kDataInputIndex, in_node)); |
| 319 | if (in_node == nullptr) { | 319 | if (in_node == nullptr) { |