Browse Source

!13518 add annotation for python api and modify some log level

From: @wangnan39
Reviewed-by: @kingxian,@zh_qh
Signed-off-by: @kingxian,@zh_qh
pull/13518/MERGE
mindspore-ci-bot Gitee 4 years ago
parent
commit
e1cdd49177
2 changed files with 6 additions and 5 deletions
  1. +4
    -4
      mindspore/core/utils/check_convert_utils.cc
  2. +2
    -1
      mindspore/nn/cell.py

+ 4
- 4
mindspore/core/utils/check_convert_utils.cc View File

@@ -230,7 +230,7 @@ bool CheckAndConvertUtils::ConvertAttrValueToInt(const std::string &op_type, con
bool CheckAndConvertUtils::ConvertAttrValueToString(const std::string &op_type, const std::string &attr_name, bool CheckAndConvertUtils::ConvertAttrValueToString(const std::string &op_type, const std::string &attr_name,
ValuePtr *const value) { ValuePtr *const value) {
if (value == nullptr || *value == nullptr) { if (value == nullptr || *value == nullptr) {
MS_LOG(INFO) << "value is nullptr! op_type = " << op_type << ", attr_name = " << attr_name;
MS_LOG(DEBUG) << "value is nullptr! op_type = " << op_type << ", attr_name = " << attr_name;
return false; return false;
} }
if (!(*value)->isa<Int64Imm>()) { if (!(*value)->isa<Int64Imm>()) {
@@ -280,7 +280,7 @@ void RestoreTargetAttr(const std::string &attr_name, ValuePtr *const value) {
void CheckAndConvertUtils::ConvertAttrValueInExport(const std::string &op_type, const std::string &attr_name, void CheckAndConvertUtils::ConvertAttrValueInExport(const std::string &op_type, const std::string &attr_name,
ValuePtr *const value) { ValuePtr *const value) {
if (value == nullptr || *value == nullptr) { if (value == nullptr || *value == nullptr) {
MS_LOG(INFO) << "value is nullptr! op_type = " << op_type << ", attr_name = " << attr_name;
MS_LOG(DEBUG) << "value is nullptr! op_type = " << op_type << ", attr_name = " << attr_name;
return; return;
} }
// convert enum to string // convert enum to string
@@ -292,7 +292,7 @@ void CheckAndConvertUtils::ConvertAttrValueInExport(const std::string &op_type,
void CheckAndConvertUtils::ConvertAttrValueInLoad(const std::string &op_type, const std::string &attr_name, void CheckAndConvertUtils::ConvertAttrValueInLoad(const std::string &op_type, const std::string &attr_name,
ValuePtr *const value) { ValuePtr *const value) {
if (value == nullptr || *value == nullptr) { if (value == nullptr || *value == nullptr) {
MS_LOG(INFO) << "value is nullptr! op_type = " << op_type << ", attr_name = " << attr_name;
MS_LOG(DEBUG) << "value is nullptr! op_type = " << op_type << ", attr_name = " << attr_name;
return; return;
} }
// convert string to enum // convert string to enum
@@ -626,7 +626,7 @@ TypeId CheckAndConvertUtils::CheckTypeSame(const std::string &arg_name, const Ty
bool CheckAndConvertUtils::CheckIrAttrtoOpAttr(const std::string &op_type, const std::string &attr_name, bool CheckAndConvertUtils::CheckIrAttrtoOpAttr(const std::string &op_type, const std::string &attr_name,
ValuePtr *const value) { ValuePtr *const value) {
if (*value == nullptr) { if (*value == nullptr) {
MS_LOG(INFO) << "value is nullptr! op_type = " << op_type << ", attr_name = " << attr_name;
MS_LOG(DEBUG) << "value is nullptr! op_type = " << op_type << ", attr_name = " << attr_name;
return false; return false;
} }
if (op_type.empty() || attr_name.empty()) { if (op_type.empty() || attr_name.empty()) {


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

@@ -1051,7 +1051,8 @@ class Cell(Cell_):
""" """
Sets the cell to training mode. Sets the cell to training mode.


The cell itself and all children cells will be set to training mode.
The cell itself and all children cells will be set to training mode. Layers that have different constructions
for training and predicting , such as `BatchNorm`, will distinguish between the branches by this attribute.


Args: Args:
mode (bool): Specifies whether the model is training. Default: True. mode (bool): Specifies whether the model is training. Default: True.


Loading…
Cancel
Save