From e40ef672b731761ea35bf6e1953be274243e4caf Mon Sep 17 00:00:00 2001 From: ougongchang Date: Fri, 25 Dec 2020 15:57:11 +0800 Subject: [PATCH] Copy image data to avoid processing the same memory --- mindspore/train/_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mindspore/train/_utils.py b/mindspore/train/_utils.py index 10dbf0a7ae..6fa951bfa8 100644 --- a/mindspore/train/_utils.py +++ b/mindspore/train/_utils.py @@ -158,6 +158,7 @@ def _construct_input_tensors(dataset_types, dataset_shapes, device_number=1): def _check_to_numpy(plugin, tensor): """Check the tensor and return a numpy.ndarray.""" np_value = tensor.asnumpy() + np_value = np_value.copy() if plugin == 'scalar': if np_value.size == 1: return np_value