!13570 fix GPU Print seg fault when printing grad result

From: @TFbunny
Reviewed-by: @robingrosman,@liangchenghui
Signed-off-by: @liangchenghui
This commit is contained in:
mindspore-ci-bot 2021-03-19 09:51:24 +08:00 committed by Gitee
commit dd9f227fd6
1 changed files with 4 additions and 0 deletions

View File

@ -67,6 +67,10 @@ bool GetOptList(const std::vector<AnfNodePtr> &node_list, std::vector<AnfNodePtr
continue;
}
auto value_node = current_node->cast<ValueNodePtr>()->value();
// not a string
if (value_node->type() == nullptr) {
continue;
}
if (value_node->type()->generic_type_id() == kObjectTypeString) {
auto current_string_value = GetValue<std::string>(value_node);
string_pos.push_back(i);