forked from mindspore-Ecosystem/mindspore
fix cpu nonop fp16 error
This commit is contained in:
parent
b1fae868ba
commit
1b1351fa17
|
@ -52,6 +52,11 @@ bool CPUDeviceAddress::SyncDeviceToHost(const std::vector<int> & /*shape*/, size
|
|||
|
||||
bool CPUDeviceAddress::SyncHostToDevice(const std::vector<int> & /*shape*/, size_t size, TypeId type,
|
||||
const void *host_ptr) const {
|
||||
if (host_ptr == ptr_) {
|
||||
MS_LOG(DEBUG) << "host_ptr is equal to ptr_, request ignored.";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type == kNumberTypeFloat16) {
|
||||
HalfToFloat(ptr_, host_ptr, size / 2);
|
||||
} else if (type == kNumberTypeFloat64) {
|
||||
|
|
|
@ -224,7 +224,8 @@ void CPUKernelRuntime::BindInputOutput(const session::KernelGraph *kernel_graph,
|
|||
(void)tensor->data_sync();
|
||||
}
|
||||
|
||||
if (tensor->data_type() == kNumberTypeFloat32 || tensor->data_type() == kNumberTypeInt32) {
|
||||
if (tensor->data_type() == address->type_id_ || tensor->data_type() == kNumberTypeFloat32 ||
|
||||
tensor->data_type() == kNumberTypeInt32) {
|
||||
address->ptr_ = tensor->data_c();
|
||||
} else {
|
||||
std::vector<int> data_shape = tensor->shape();
|
||||
|
|
Loading…
Reference in New Issue