Browse Source

Copy image data to avoid processing the same memory

tags/v1.2.0-rc1
ougongchang 5 years ago
parent
commit
e40ef672b7
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      mindspore/train/_utils.py

+ 1
- 0
mindspore/train/_utils.py View File

@@ -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


Loading…
Cancel
Save