|
|
|
@ -41,9 +41,9 @@ Attribute GetAttrValue(const OpDesc::Attr& attr_desc);
|
|
|
|
|
|
|
|
|
|
// check whether a value(attribute) fit a certain limit
|
|
|
|
|
template <typename T>
|
|
|
|
|
class LargerThanChecker {
|
|
|
|
|
class GreaterThanChecker {
|
|
|
|
|
public:
|
|
|
|
|
explicit LargerThanChecker(T lower_bound) : lower_bound_(lower_bound) {}
|
|
|
|
|
explicit GreaterThanChecker(T lower_bound) : lower_bound_(lower_bound) {}
|
|
|
|
|
void operator()(T& value) const {
|
|
|
|
|
PADDLE_ENFORCE(value > lower_bound_, "larger_than check fail");
|
|
|
|
|
}
|
|
|
|
@ -110,8 +110,8 @@ class TypedAttrChecker {
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TypedAttrChecker& LargerThan(const T& lower_bound) {
|
|
|
|
|
value_checkers_.push_back(LargerThanChecker<T>(lower_bound));
|
|
|
|
|
TypedAttrChecker& GreaterThan(const T& lower_bound) {
|
|
|
|
|
value_checkers_.push_back(GreaterThanChecker<T>(lower_bound));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|