!824 Check whether the value tuple is empty when converting it to tuple tensor

Merge pull request !824 from YuJianfeng/master
This commit is contained in:
mindspore-ci-bot 2020-04-28 22:57:32 +08:00 committed by Gitee
commit ae9cdc4aa6
1 changed files with 4 additions and 0 deletions

View File

@ -299,6 +299,10 @@ tensor::TensorPtr CreateTensorWithValueTuple(const ValueTuplePtr &value_tuple_pt
tensor::TensorPtr CreateTupleTensor(const ValueTuplePtr &value_tuple) {
MS_EXCEPTION_IF_NULL(value_tuple);
tensor::TensorPtr tensor = nullptr;
if (value_tuple->value().empty()) {
MS_LOG(WARNING) << "The value tuple is empty.";
return nullptr;
}
ValuePtr v = *(value_tuple->value().begin());
MS_EXCEPTION_IF_NULL(v);
// Currently we only deal with the scalar tuple