forked from OSSInnovation/mindspore
!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:
commit
77f9adf9e3
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue