!30745 Bugfix in ConvertNonscalarTensorToParameter when value is uninitialized
Merge pull request !30745 from DeshiChen/0228_uninit_value
This commit is contained in:
commit
b631a1065e
|
@ -110,10 +110,11 @@ bool ConvertNonscalarTensorToParameter(const FuncGraphPtr &fg, AnfNodePtrList *c
|
||||||
for (size_t i = 1; i < inputs.size(); ++i) {
|
for (size_t i = 1; i < inputs.size(); ++i) {
|
||||||
const auto &tnode = inputs[i];
|
const auto &tnode = inputs[i];
|
||||||
auto tensor = GetValueNode<tensor::TensorPtr>(tnode);
|
auto tensor = GetValueNode<tensor::TensorPtr>(tnode);
|
||||||
if (tensor == nullptr || tensor->DataSize() == 1) {
|
if (tensor == nullptr) continue;
|
||||||
continue;
|
// data is nullptr means uninitialized.
|
||||||
|
if (tensor->data().const_data() == nullptr || tensor->DataSize() > 1) {
|
||||||
|
(void)value_nodes.insert(tnode);
|
||||||
}
|
}
|
||||||
(void)value_nodes.insert(tnode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (value_nodes.empty()) return false;
|
if (value_nodes.empty()) return false;
|
||||||
|
|
Loading…
Reference in New Issue