!46933 data sync before get tensor value

Merge pull request !46933 from looop5/data_sync_master
This commit is contained in:
i-robot 2022-12-19 06:32:27 +00:00 committed by Gitee
commit 5cc85b0467
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 3 additions and 0 deletions

View File

@ -211,6 +211,9 @@ int64_t GetIntValue(const NodePtr &node) { return AnfUtils::GetIntValue(node->ge
std::vector<int64_t> GetIntList(const ValuePtr &value) {
MS_EXCEPTION_IF_NULL(value);
if (value->isa<tensor::Tensor>()) {
auto tensor = value->cast<tensor::TensorPtr>();
MS_EXCEPTION_IF_NULL(tensor);
tensor->data_sync();
return CheckAndConvertUtils::CheckTensorIntValue("tensor", value, "bprop");
} else {
return CheckAndConvertUtils::CheckIntOrTupleInt("value", value, "bprop");