Browse Source

check device list size in context

pull/16039/head
mengyuanli 4 years ago
parent
commit
aa8051a9e8
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      mindspore/lite/src/inner_context.cc

+ 4
- 0
mindspore/lite/src/inner_context.cc View File

@@ -104,6 +104,10 @@ int InnerContext::IsValid() const {
MS_LOG(ERROR) << "Device list is empty."; MS_LOG(ERROR) << "Device list is empty.";
return RET_NOT_SUPPORT; return RET_NOT_SUPPORT;
} }
if (this->device_list_.size() > 2) {
MS_LOG(ERROR) << "Not support device list more than 2.";
return RET_NOT_SUPPORT;
}
if (!IsUserSetCpu()) { if (!IsUserSetCpu()) {
MS_LOG(ERROR) << "CPU context should be set."; MS_LOG(ERROR) << "CPU context should be set.";
return RET_NOT_SUPPORT; return RET_NOT_SUPPORT;


Loading…
Cancel
Save