已合并
【质量加固】修改若干符合规则要求的代码规范问题 #4639
zlp1703创建于 6 天前
【质量加固】修改若干符合规则要求的代码规范问题 #4639
已合并
zlp1703创建于 6 天前
5 个文件变更+8-8
@@ -25,7 +25,7 @@ namespace ge {
25namespace fusion {25namespace fusion {
26namespace {26namespace {
27template <typename T>27template <typename T>
28-bool IsTensorDataEqualWith(ConstGeTensorPtr &a_tensor, ConstGeTensorPtr &b_tensor, size_t shape_size) {28+bool IsTensorDataEqualWith(const ConstGeTensorPtr &a_tensor, const ConstGeTensorPtr &b_tensor, size_t shape_size) {
29 const auto *a_value = reinterpret_cast<const T *>(a_tensor->GetData().data());29 const auto *a_value = reinterpret_cast<const T *>(a_tensor->GetData().data());
30 const auto *b_value = reinterpret_cast<const T *>(b_tensor->GetData().data());30 const auto *b_value = reinterpret_cast<const T *>(b_tensor->GetData().data());
31 for (size_t i = 0U; i < shape_size; ++i) {31 for (size_t i = 0U; i < shape_size; ++i) {
@@ -36,7 +36,7 @@ bool IsTensorDataEqualWith(ConstGeTensorPtr &a_tensor, ConstGeTensorPtr &b_tenso
36 return true;36 return true;
37}37}
38 38 
39-bool IsTensorEqualWith(ConstGeTensorPtr &a_tensor, ConstGeTensorPtr &b_tensor) {39+bool IsTensorEqualWith(const ConstGeTensorPtr &a_tensor, const ConstGeTensorPtr &b_tensor) {
40 const auto &a_tensor_desc = a_tensor->GetTensorDesc();40 const auto &a_tensor_desc = a_tensor->GetTensorDesc();
41 const auto &b_tensor_desc = b_tensor->GetTensorDesc();41 const auto &b_tensor_desc = b_tensor->GetTensorDesc();
42 42 
@@ -542,7 +542,7 @@ Status GraphManager::Initialize(const std::map<std::string, std::string> &option
542 return SUCCESS;542 return SUCCESS;
543}543}
544 544 
545-void GraphManager::SetExternalGraphRebuildStateCtrl(std::shared_ptr<GraphRebuildStateCtrl> &rebuild_ctrl) {545+void GraphManager::SetExternalGraphRebuildStateCtrl(const std::shared_ptr<GraphRebuildStateCtrl> &rebuild_ctrl) {
546 if (rebuild_ctrl != nullptr) {546 if (rebuild_ctrl != nullptr) {
547 GELOGI("graph rebuild state ctrl is set from external");547 GELOGI("graph rebuild state ctrl is set from external");
548 graph_rebuild_state_ctrl_ = rebuild_ctrl;548 graph_rebuild_state_ctrl_ = rebuild_ctrl;
@@ -4032,7 +4032,7 @@ Status GraphManager::SetCompiledFlag(uint32_t graph_id, bool flag) {
4032 return SUCCESS;4032 return SUCCESS;
4033}4033}
4034 4034 
4035-const std::map<std::string, std::string> *GraphManager::GetGraphOptions(uint32_t graph_id) {4035+const std::map<std::string, std::string> *GraphManager::GetGraphOptions(uint32_t graph_id) const {
4036 GraphNodePtr graph_node = nullptr;4036 GraphNodePtr graph_node = nullptr;
4037 Status ret = GetGraphNode(graph_id, graph_node);4037 Status ret = GetGraphNode(graph_id, graph_node);
4038 if (ret != SUCCESS) {4038 if (ret != SUCCESS) {
@@ -182,7 +182,7 @@ class GraphManager {
182 182 
183 Status CheckGraphValidBeforeExecute(const GraphId &graph_id, GraphNodePtr &graph_node) const;183 Status CheckGraphValidBeforeExecute(const GraphId &graph_id, GraphNodePtr &graph_node) const;
184 184 
185- const std::map<std::string, std::string> *GetGraphOptions(uint32_t graph_id);185+ const std::map<std::string, std::string> *GetGraphOptions(uint32_t graph_id) const;
186 186 
187 void SetOptionsRunGraphFlag(bool run_graph_flag);187 void SetOptionsRunGraphFlag(bool run_graph_flag);
188 188 
@@ -242,7 +242,7 @@ class GraphManager {
242 std::vector<std::pair<uint64_t, uint64_t>> &cross_ranges) const;242 std::vector<std::pair<uint64_t, uint64_t>> &cross_ranges) const;
243 243 
244 // temporary solution, set rebuild_ctrl from external to share variable change between different graph_manager object244 // temporary solution, set rebuild_ctrl from external to share variable change between different graph_manager object
245- void SetExternalGraphRebuildStateCtrl(std::shared_ptr<GraphRebuildStateCtrl> &rebuild_ctrl);245+ void SetExternalGraphRebuildStateCtrl(const std::shared_ptr<GraphRebuildStateCtrl> &rebuild_ctrl);
246 Status SetFrozenInputAttrs(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node) const;246 Status SetFrozenInputAttrs(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node) const;
247 void UpdateLocalOmgContext(GraphId graph_id);247 void UpdateLocalOmgContext(GraphId graph_id);
248 Status StartForRunGraph(const GraphNodePtr &graph_node, const std::vector<GeTensor> &inputs,248 Status StartForRunGraph(const GraphNodePtr &graph_node, const std::vector<GeTensor> &inputs,
@@ -492,7 +492,7 @@ bool NotaskPassBase::IsPreNodeTypeValid(const ge::InDataAnchorPtr &in_anchor) co
492 return false;492 return false;
493 }493 }
494 const std::string op_type = node->GetType();494 const std::string op_type = node->GetType();
495- static std::set<std::string> not_support_type = {DATA, REFDATA, VARIABLE, CONSTANTOP, CONSTANT};495+ static const std::set<std::string> not_support_type = {DATA, REFDATA, VARIABLE, CONSTANTOP, CONSTANT};
496 if (not_support_type.count(op_type) != 0U) {496 if (not_support_type.count(op_type) != 0U) {
497 GELOGD("node [%s] pre node [%s] opType is %s.", cur_pro_node_name_.c_str(), node->GetName().c_str(),497 GELOGD("node [%s] pre node [%s] opType is %s.", cur_pro_node_name_.c_str(), node->GetName().c_str(),
498 op_type.c_str());498 op_type.c_str());
@@ -1450,7 +1450,7 @@ Status GraphPrepare::CheckGraphAndUpdateOriginShape() const {
1450 1450 
1451Status GraphPrepare::CheckRefInputNode(const NodePtr &node, const std::string &input_name,1451Status GraphPrepare::CheckRefInputNode(const NodePtr &node, const std::string &input_name,
1452 const std::set<NodePtr> &ref_nodes) const {1452 const std::set<NodePtr> &ref_nodes) const {
1453- static std::set<std::string> block_list = {ge::CONSTANTOP, ge::CONSTANT};1453+ static const std::set<std::string> block_list = {ge::CONSTANTOP, ge::CONSTANT};
1454 GE_CHECK_NOTNULL(node);1454 GE_CHECK_NOTNULL(node);
1455 const auto &op_desc = node->GetOpDesc();1455 const auto &op_desc = node->GetOpDesc();
1456 GE_CHECK_NOTNULL(op_desc);1456 GE_CHECK_NOTNULL(op_desc);