Fix getting attribute in TF FE (#10458)

* if attribute is not present and default value provided it should return default value
This commit is contained in:
Maxim Vafin 2022-02-17 20:30:04 +03:00 committed by GitHub
parent b8bbe056b1
commit ac880f601c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -48,7 +48,6 @@ public:
ov::Any get_attribute_as_any(const std::string& name) const override {
auto res = m_decoder.get_attribute(name);
FRONT_END_GENERAL_CHECK(!res.empty(), "Attribute with name '", name, "' does not exist");
return res;
}

View File

@ -165,14 +165,12 @@ const std::string& DecoderProto::get_op_name() const {
std::vector<::tensorflow::AttrValue> DecoderProto::decode_attribute_helper(const std::string& name) const {
auto attr_map = m_node_def->attr();
FRONT_END_GENERAL_CHECK(attr_map.contains(name),
"An error occurred while parsing the ",
name,
" attribute of ",
this->get_op_type(),
"node");
auto value = m_node_def->attr().at(name);
return {value};
if (attr_map.contains(name)) {
auto value = m_node_def->attr().at(name);
return {value};
} else {
return {};
}
}
} // namespace tensorflow
} // namespace frontend