diff --git a/docs/api/api_python/mindspore/mindspore.Model.rst b/docs/api/api_python/mindspore/mindspore.Model.rst index 665a6141906..76f6c3cd97e 100644 --- a/docs/api/api_python/mindspore/mindspore.Model.rst +++ b/docs/api/api_python/mindspore/mindspore.Model.rst @@ -5,6 +5,10 @@ 模型训练或推理的高阶接口。 `Model` 会根据用户传入的参数封装可训练或推理的实例。 + .. note:: + 如果使用混合精度功能,需要同时设置`optimizer`参数,否则混合精度功能不生效。 + 当使用混合精度时,优化器中的 `global_step` 可能与模型中的 `cur_step_num` 不同。 + **参数:** - **network** (Cell) – 用于训练或推理的神经网络。 diff --git a/mindspore/python/mindspore/common/parameter.py b/mindspore/python/mindspore/common/parameter.py index d371f19e004..5649368a048 100644 --- a/mindspore/python/mindspore/common/parameter.py +++ b/mindspore/python/mindspore/common/parameter.py @@ -210,7 +210,7 @@ class Parameter(Tensor_): def __deepcopy__(self, memodict): new_obj = Parameter(self) new_obj.name = self.name - new_obj._inited_param = self._inited_param # pylint: disable=W0212 + new_obj._inited_param = self._inited_param return new_obj @staticmethod diff --git a/mindspore/python/mindspore/ops/operations/debug_ops.py b/mindspore/python/mindspore/ops/operations/debug_ops.py index cdd35796599..49d85730b57 100644 --- a/mindspore/python/mindspore/ops/operations/debug_ops.py +++ b/mindspore/python/mindspore/ops/operations/debug_ops.py @@ -411,6 +411,10 @@ class Print(PrimitiveWithInfer): In pynative mode, please use python print function. In graph mode, the bool, int and float would be converted into Tensor to print, str remains unchanged. + This function is used for debug. When too many print data at the same time, + in order not to affect the main process, the framework may discard some data. At this time, + if you need to record the data completely, you can recommended to use the `Summary` function. Please check + `Summary `_. Inputs: - **input_x** (Union[Tensor, bool, int, float, str]) - The graph node to attach to. diff --git a/mindspore/python/mindspore/train/model.py b/mindspore/python/mindspore/train/model.py index 5e8271da7c3..47550f1acaf 100644 --- a/mindspore/python/mindspore/train/model.py +++ b/mindspore/python/mindspore/train/model.py @@ -93,6 +93,11 @@ class Model: `Model` groups layers into an object with training and inference features based on the arguments. + Note: + If use mixed precision functions, need to set parameter `optimizer` at the same time, + otherwise mixed precision functions do not take effect. + When uses mixed precision functions, `global_step` in optimizer may be different from `cur_step_num` in Model. + Args: network (Cell): A training or testing network. loss_fn (Cell): Objective function. If `loss_fn` is None, the `network` should contain the calculation of loss