!14540 memcpy_s function reports errors when tensor is greater than 2147483647 bit.

From: @wangyanling10
Reviewed-by: @wuxuejian,@liangchenghui
Signed-off-by: @wuxuejian
This commit is contained in:
mindspore-ci-bot 2021-04-06 09:38:39 +08:00 committed by Gitee
commit 77f9adf9e3
2 changed files with 7 additions and 3 deletions

View File

@ -191,8 +191,12 @@ void SliceCPUKernel::CopyDataToOutput(const std::vector<kernel::AddressPtr> &inp
MS_LOG(EXCEPTION) << id << " output memory out of bounds.";
}
auto ret = memcpy_s(output_addr + out_offset, out_buff_size - out_offset * sizeof(T), input_addr + in_offset,
copy_num * sizeof(T));
size_t buff_size = out_buff_size - out_offset * sizeof(T);
size_t copy_size = copy_num * sizeof(T);
if (buff_size < copy_size) {
MS_LOG(EXCEPTION) << "output buffer is not enough. memcpy failed!";
}
auto ret = memcpy_s(output_addr + out_offset, copy_size, input_addr + in_offset, copy_size);
if (ret != EOK) {
MS_LOG(EXCEPTION) << "memcpy failed. ret:" << ret;
}

View File

@ -814,7 +814,7 @@ class BCELoss(_Loss):
ValueError: If shape of `inputs` is not the same as `labels` or `weight` (if given).
Supported Platforms:
``Ascend`` ``GPU``
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> weight = Tensor(np.array([[1.0, 2.0, 3.0], [4.0, 3.3, 2.2]]), mindspore.float32)