!37859 fix cle pattern
Merge pull request !37859 from yeyunpeng2020/master_cle
This commit is contained in:
commit
8eda6b33a9
|
@ -35,7 +35,7 @@ std::unordered_map<std::string, VectorRef> CLEPattern::DefinePatterns() const {
|
||||||
|
|
||||||
bool IsLinearActivation(const api::SharedPtr<ops::Conv2DFusion> &conv2d) {
|
bool IsLinearActivation(const api::SharedPtr<ops::Conv2DFusion> &conv2d) {
|
||||||
std::set<ActivationType> liner_activations = {RELU, NO_ACTIVATION};
|
std::set<ActivationType> liner_activations = {RELU, NO_ACTIVATION};
|
||||||
auto value_ptr = conv2d->GetAttr(ops::kActivation);
|
auto value_ptr = conv2d->GetAttr(ops::kActivationType);
|
||||||
if (value_ptr == nullptr || liner_activations.find(conv2d->get_activation_type()) != liner_activations.end()) {
|
if (value_ptr == nullptr || liner_activations.find(conv2d->get_activation_type()) != liner_activations.end()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -58,13 +58,13 @@ bool IsConvNode(const BaseRef &n, ConvNode node) {
|
||||||
if (conv == nullptr) {
|
if (conv == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!IsLinearActivation(conv)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (node == COMMON_CONV) {
|
if (node == COMMON_CONV) {
|
||||||
return conv->get_group() == 1;
|
return conv->get_group() == 1;
|
||||||
} else if (node == DEPTHWISE_CONV) {
|
} else if (node == DEPTHWISE_CONV) {
|
||||||
bool ret = IsLinearActivation(conv) && conv->GetAttr(ops::kIsDepthWise) != nullptr &&
|
return conv->GetAttr(ops::kIsDepthWise) != nullptr && GetValue<bool>(conv->GetAttr(ops::kIsDepthWise));
|
||||||
GetValue<bool>(conv->GetAttr(ops::kIsDepthWise));
|
|
||||||
return ret;
|
|
||||||
} else {
|
} else {
|
||||||
MS_LOG(ERROR) << "Not supported conv node type.";
|
MS_LOG(ERROR) << "Not supported conv node type.";
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue