forked from mindspore-Ecosystem/mindspore
fix context error for unfied API
This commit is contained in:
parent
6b9de24797
commit
ad7ce7881d
|
@ -121,9 +121,9 @@ void CPUDeviceInfo::SetThreadAffinity(int affinity) {
|
|||
int CPUDeviceInfo::GetThreadAffinity() const {
|
||||
if (data_ == nullptr) {
|
||||
MS_LOG(ERROR) << "Invalid context.";
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
return GetValue<bool>(data_, kModelOptionCpuThreadAffinity);
|
||||
return GetValue<int>(data_, kModelOptionCpuThreadAffinity);
|
||||
}
|
||||
|
||||
void MaliGPUDeviceInfo::SetEnableFP16(bool is_fp16) {
|
||||
|
|
|
@ -95,12 +95,12 @@ Status ModelImpl::Build() {
|
|||
lite::DeviceInfo cpu_info = {.cpu_device_info_ = {cpu_context->GetEnableFP16(), mode}};
|
||||
model_context.device_list_.push_back({lite::DT_CPU, cpu_info});
|
||||
if (device_list.size() == 2) {
|
||||
if (device_list[0]->GetDeviceType() == kMaliGPU) {
|
||||
auto gpu_context = device_list[0]->Cast<MaliGPUDeviceInfo>();
|
||||
if (device_list[1]->GetDeviceType() == kMaliGPU) {
|
||||
auto gpu_context = device_list[1]->Cast<MaliGPUDeviceInfo>();
|
||||
lite::DeviceInfo gpu_info = {.gpu_device_info_ = {gpu_context->GetEnableFP16()}};
|
||||
model_context.device_list_.push_back({lite::DT_GPU, gpu_info});
|
||||
} else if (device_list[0]->GetDeviceType() == kKirinNPU) {
|
||||
auto npu_context = device_list[0]->Cast<KirinNPUDeviceInfo>();
|
||||
} else if (device_list[1]->GetDeviceType() == kKirinNPU) {
|
||||
auto npu_context = device_list[1]->Cast<KirinNPUDeviceInfo>();
|
||||
lite::DeviceInfo npu_info = {.npu_device_info_ = {npu_context->GetFrequency()}};
|
||||
model_context.device_list_.push_back({lite::DT_NPU, npu_info});
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue