Browse Source

trim file name if it got too long

pull/318/head
chuxing 4 years ago
parent
commit
4d9719c975
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      ge/offline/single_op_parser.cc

+ 6
- 1
ge/offline/single_op_parser.cc View File

@@ -54,6 +54,7 @@ constexpr int kDumpJsonIndent = 2;
constexpr int kShapeRangePairSize = 2;
constexpr int kShapeRangeLow = 0;
constexpr int kShapeRangeHigh = 1;
constexpr int kMaxFileNameLen = 128;

map<string, GeAttrValue::ValueType> kAttrTypeDict = {
{"bool", GeAttrValue::VT_BOOL},
@@ -363,8 +364,12 @@ Status SingleOpParser::ConvertToBuildParam(int index,
return PARAM_INVALID;
}

file_name << kFileSuffix;
build_param.file_name = file_name.str();
if (build_param.file_name.length() > kMaxFileNameLen) {
GELOGI("Trim file name for it is too long, origin file name = %s", build_param.file_name.c_str());
build_param.file_name = build_param.file_name.substr(0, kMaxFileNameLen);
}
build_param.file_name += kFileSuffix;
build_param.op_desc.reset(op_desc.release());
return SUCCESS;
}


Loading…
Cancel
Save