Browse Source

fix codedex

tags/v0.5.0-beta
leopz 5 years ago
parent
commit
6d155e5f4a
5 changed files with 16 additions and 12 deletions
  1. +7
    -3
      mindspore/ccsrc/debug/anf_ir_utils.cc
  2. +1
    -1
      mindspore/ccsrc/ir/primitive_base.h
  3. +1
    -1
      mindspore/ccsrc/pipeline/pipeline.cc
  4. +1
    -1
      mindspore/ccsrc/utils/log_adapter.cc
  5. +6
    -6
      mindspore/ccsrc/utils/utils.h

+ 7
- 3
mindspore/ccsrc/debug/anf_ir_utils.cc View File

@@ -1982,7 +1982,11 @@ class IrParser {
MS_LOG(EXCEPTION) << "Cast to type 'PrimitivePyPtr' error";
}
} else {
ptr = std::make_shared<PrimitivePy>(id.substr(strlen("PrimitivePy::")), py_obj);
auto len = strlen("PrimitivePy::");
if (id.size() < len) {
return TOK_ERROR;
}
ptr = std::make_shared<PrimitivePy>(id.substr(len), py_obj);
}
*val_ptr = ptr;

@@ -1999,7 +2003,7 @@ class IrParser {
return next;
}

Token ParseValueGraphAndNamespace(const std::string &id, ValuePtr *val_ptr) {
Token ParseValueGraphAndNamespace(const std::string &id, ValuePtr *const val_ptr) {
if (Match(id, "MultitypeFuncGraph::")) {
std::string name = id.substr(strlen("MultitypeFuncGraph::"));
auto mt_func_graph = std::make_shared<prim::MultitypeFuncGraph>(name);
@@ -2039,7 +2043,7 @@ class IrParser {
}
}

Token ParseValueBasic(const FuncGraphPtr &func_graph, const std::string &id, ValuePtr *val_ptr,
Token ParseValueBasic(const FuncGraphPtr &func_graph, const std::string &id, ValuePtr *const val_ptr,
AnfNodePtr *const node_ptr = nullptr) {
if (id == "None") {
*val_ptr = std::make_shared<None>();


+ 1
- 1
mindspore/ccsrc/ir/primitive_base.h View File

@@ -90,7 +90,7 @@ class Primitive : public Named {
}

const std::unordered_map<std::string, ValuePtr> &attrs() const { return attrs_; }
std::unordered_map<std::string, ValuePtr> &evaluate_added_attrs() { return evaluate_added_attrs_; }
const std::unordered_map<std::string, ValuePtr> &evaluate_added_attrs() const { return evaluate_added_attrs_; }

// if Primitive has any attribute, for Primitives like scalar_add, return, etc, don't have any attribute.
bool HasAttr() const { return !attrs_.empty(); }


+ 1
- 1
mindspore/ccsrc/pipeline/pipeline.cc View File

@@ -646,7 +646,7 @@ void ProcessVmArgInner(const py::tuple &args, const ResourcePtr &res, VectorRef
}
}

void ExecutorPy::ProcessVmArg(const py::tuple &args, const std::string &phase, VectorRef *arg_list) {
void ExecutorPy::ProcessVmArg(const py::tuple &args, const std::string &phase, VectorRef *const arg_list) {
ProcessVmArgInner(args, GetResource(phase), arg_list);
}



+ 1
- 1
mindspore/ccsrc/utils/log_adapter.cc View File

@@ -289,7 +289,7 @@ class LogConfigLexer {
return '\0';
}

LogConfigToken GetNext(std::string *ptr) {
LogConfigToken GetNext(std::string *const ptr) {
#ifdef DEBUG
std::string text;
auto tok = GetNextInner(&text);


+ 6
- 6
mindspore/ccsrc/utils/utils.h View File

@@ -261,12 +261,12 @@ const std::set<std::string> kNeedTransFormatSet = {kOpFormat_FRAC_Z, kOpFo
kOpFormat_FRACTAL_Z_C04};

static inline void ChangeFileMode(const std::string &file_name, mode_t mode) {
if (access(file_name.c_str(), F_OK) != 0) {
MS_LOG(DEBUG) << "File `" << file_name << "` does not exist.";
return;
}
if (chmod(file_name.c_str(), mode) != 0) {
MS_LOG(WARNING) << "Change file `" << file_name << "` to mode " << std::oct << mode << " fail.";
try {
if (chmod(file_name.c_str(), mode) != 0) {
MS_LOG(WARNING) << "Change file `" << file_name << "` to mode " << std::oct << mode << " fail.";
}
} catch (std::exception &e) {
MS_LOG(DEBUG) << "File `" << file_name << "` change mode failed! May be not exist.";
}
}
} // namespace mindspore


Loading…
Cancel
Save