Browse Source

code check for master

tags/v1.5.0-rc1
liutongtong 4 years ago
parent
commit
077f10b7b6
21 changed files with 28 additions and 31 deletions
  1. +1
    -1
      mindspore/common/__init__.py
  2. +1
    -1
      mindspore/common/_monad.py
  3. +1
    -1
      mindspore/common/_register_for_tensor.py
  4. +1
    -2
      mindspore/common/api.py
  5. +1
    -1
      mindspore/common/dtype.py
  6. +4
    -5
      mindspore/common/initializer.py
  7. +2
    -2
      mindspore/common/parameter.py
  8. +1
    -1
      mindspore/common/seed.py
  9. +0
    -1
      mindspore/common/tensor.py
  10. +2
    -2
      mindspore/nn/cell.py
  11. +1
    -1
      mindspore/nn/metrics/__init__.py
  12. +1
    -1
      mindspore/nn/metrics/error.py
  13. +1
    -1
      mindspore/nn/metrics/fbeta.py
  14. +1
    -1
      mindspore/nn/metrics/loss.py
  15. +1
    -1
      mindspore/nn/metrics/metric.py
  16. +1
    -1
      mindspore/nn/metrics/precision.py
  17. +1
    -1
      mindspore/nn/metrics/recall.py
  18. +1
    -1
      mindspore/nn/metrics/topk.py
  19. +1
    -1
      mindspore/train/callback/_checkpoint.py
  20. +1
    -1
      mindspore/train/model.py
  21. +4
    -4
      mindspore/train/serialization.py

+ 1
- 1
mindspore/common/__init__.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/common/_monad.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/common/_register_for_tensor.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 2
mindspore/common/api.py View File

@@ -1,6 +1,6 @@
# This is the Python adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/).
#
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -169,7 +169,6 @@ class _MindsporeFunctionExecutor:
key = generate_arguments_key(dic)
phase = generate_name + '.' + str(key)
if phase not in ms_compile_cache.keys():
is_compile = False
if self.obj is None:
is_compile = self._graph_executor.compile(self.fn, args_list, phase, True, "")
else:


+ 1
- 1
mindspore/common/dtype.py View File

@@ -1,6 +1,6 @@
# This is the Python adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/).
#
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 4
- 5
mindspore/common/initializer.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ def _register(*aliases):
def _assignment(arr, num):
"""Assign the value of `num` to `arr`."""
if arr.shape == ():
arr = arr.reshape((1))
arr = arr.reshape(1)
arr[:] = num
arr = arr.reshape(())
else:
@@ -155,9 +155,8 @@ def _calculate_fan_in_and_fan_out(shape):
num_input_fmaps = shape[1]
num_output_fmaps = shape[0]
receptive_field_size = 1
if dimensions > 2:
for i in range(2, dimensions):
receptive_field_size *= shape[i]
for i in range(2, dimensions):
receptive_field_size *= shape[i]
fan_in = num_input_fmaps * receptive_field_size
fan_out = num_output_fmaps * receptive_field_size
return fan_in, fan_out


+ 2
- 2
mindspore/common/parameter.py View File

@@ -499,7 +499,7 @@ class Parameter(Tensor_):
current_tensor_is_init = isinstance(self, Tensor) and not self.has_init

if incoming_tensor_is_init and not current_tensor_is_init:
raise TypeError("Parameter is a `Tensor` and not initializered, `data` for `set_data`"
raise TypeError("Parameter is a `Tensor` and not initialized, `data` for `set_data`"
"should be a Tensor. If you want to update it by Tensor, call method"
"`init_parameters_data` of `Cell` to init and replace all the Parameter of"
"network, then call this method.")
@@ -515,7 +515,7 @@ class Parameter(Tensor_):
from mindspore.ops import functional as F
data = F.cast(data, self.dtype)
if isinstance(data, Tensor) and data.has_init:
# The parameter has been initializered, directly update by the data
# The parameter has been initialized, directly update by the data
if current_tensor_is_init:
self._update_tensor_data(data.init_data())
else:


+ 1
- 1
mindspore/common/seed.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 0
- 1
mindspore/common/tensor.py View File

@@ -734,7 +734,6 @@ class Tensor(Tensor_):
axis1, axis2 = axis2, axis1

perm = tuple(range(0, self.ndim))
new_perm = None
if axis2 + 1 < self.ndim:
new_perm = perm[0:axis1] + perm[axis2:axis2+1] + \
perm[axis1+1:axis2] + perm[axis1:axis1+1] + perm[axis2+1:]


+ 2
- 2
mindspore/nn/cell.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -1294,7 +1294,7 @@ class Cell(Cell_):
self._scope = prefix
elif not self._scope.startswith(prefix):
self._scope = prefix + self._scope
elif not self._scope is None and self._scope.startswith(prefix):
elif self._scope is not None and self._scope.startswith(prefix):
self._scope = self._scope[len(prefix):]

def _mp_comm_recompute(self, mp_comm_recompute=True):


+ 1
- 1
mindspore/nn/metrics/__init__.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/nn/metrics/error.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/nn/metrics/fbeta.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/nn/metrics/loss.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/nn/metrics/metric.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/nn/metrics/precision.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/nn/metrics/recall.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/nn/metrics/topk.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/train/callback/_checkpoint.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 1
- 1
mindspore/train/model.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.


+ 4
- 4
mindspore/train/serialization.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -241,7 +241,7 @@ def save_checkpoint(save_obj, ckpt_file_name, integrated_save=True,
each_param = {"name": key}
param_data = Tensor(value.data)

# in automatic model parallel scenario, some parameters were spliteds to all the devices,
# in automatic model parallel scenario, some parameters were split to all the devices,
# which should be combined before saving
if key in save_obj.parameter_layout_dict:
param_data = _get_merged_param_data(save_obj, key, param_data, integrated_save)
@@ -1365,9 +1365,9 @@ def load_distributed_checkpoint(network, checkpoint_filenames, predict_strategy=
param_dict[param.name] = split_param

if param_not_in_strategy:
logger.warning("{} parameters in network are not in the sclice strategy.".format(param_not_in_strategy))
logger.warning("{} parameters in network are not in the slice strategy.".format(param_not_in_strategy))
if param_not_in_ckpt:
logger.warning("{} parameters in sclice strategy but not in the checkpoint file.".format(param_not_in_ckpt))
logger.warning("{} parameters in slice strategy but not in the checkpoint file.".format(param_not_in_ckpt))

load_param_into_net(network, param_dict)



Loading…
Cancel
Save