From 4e54ab76ecb7e86dcfbfd59824bc2c5593513809 Mon Sep 17 00:00:00 2001 From: Michal Gallus Date: Tue, 6 Nov 2018 10:57:15 +0100 Subject: [PATCH] Add HasAttr method to Operator --- paddle/fluid/framework/operator.h | 1 + 1 file changed, 1 insertion(+) diff --git a/paddle/fluid/framework/operator.h b/paddle/fluid/framework/operator.h index 40b0130b265..6918e030bf8 100644 --- a/paddle/fluid/framework/operator.h +++ b/paddle/fluid/framework/operator.h @@ -100,6 +100,7 @@ class OperatorBase { const std::string& Type() const { return type_; } + bool HasAttr(const std::string& name) const { return attrs_.count(name); } template inline const T& Attr(const std::string& name) const { PADDLE_ENFORCE(attrs_.count(name) != 0, "%s should be in AttributeMap", -- GitLab