Browse Source

!2909 Simplify PrimitiveTotalEqual

Merge pull request !2909 from Kang/master
tags/v0.6.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
1be24257a6
1 changed files with 3 additions and 21 deletions
  1. +3
    -21
      mindspore/ccsrc/optimizer/ad/dfunctor.h

+ 3
- 21
mindspore/ccsrc/optimizer/ad/dfunctor.h View File

@@ -37,27 +37,9 @@ namespace mindspore {
namespace ad { namespace ad {
struct PrimitiveTotalEqual { struct PrimitiveTotalEqual {
bool operator()(PrimitivePtr const &t1, PrimitivePtr const &t2) const { bool operator()(PrimitivePtr const &t1, PrimitivePtr const &t2) const {
if (t1->name() != t2->name()) {
return false;
}

auto const &attrs1 = t1->attrs();
auto const &attrs2 = t2->attrs();
if (attrs1.size() != attrs2.size()) {
return false;
}

for (auto &attr1 : attrs1) {
if (!t2->HasAttr(attr1.first)) {
return false;
}

if (!(*(attr1.second) == *(t2->GetAttr(attr1.first)))) {
return false;
}
}

return true;
MS_EXCEPTION_IF_NULL(t1);
MS_EXCEPTION_IF_NULL(t2);
return *t1 == *t2;
} }
}; };




Loading…
Cancel
Save