forked from mindspore-Ecosystem/mindspore
!20385 ci format check error fix.
Merge pull request !20385 from zhangzhaoju/master_ci_format
This commit is contained in:
commit
7a4837c80c
|
@ -45,7 +45,6 @@
|
|||
using mindspore::tensor::TensorPy;
|
||||
|
||||
namespace mindspore {
|
||||
|
||||
std::string GetKernelNodeName(const AnfNodePtr &anf_node) {
|
||||
std::string kernel_name = anf_node->fullname_with_scope();
|
||||
if (kernel_name.empty()) {
|
||||
|
|
|
@ -132,10 +132,11 @@ uint64_t GetTimeStamp() {
|
|||
}
|
||||
|
||||
std::string GetOpNameWithoutScope(const std::string &fullname_with_scope) {
|
||||
std::size_t found = fullname_with_scope.rfind("--");
|
||||
const std::string separator("--");
|
||||
std::size_t found = fullname_with_scope.rfind(separator);
|
||||
std::string op_name;
|
||||
if (found != std::string::npos) {
|
||||
op_name = fullname_with_scope.substr(found + 2);
|
||||
op_name = fullname_with_scope.substr(found + separator.length());
|
||||
}
|
||||
return op_name;
|
||||
}
|
||||
|
|
|
@ -474,8 +474,7 @@ void DebugServices::ConvertToHostFormat(const std::map<std::string, std::vector<
|
|||
MS_LOG(EXCEPTION) << "Can't find package mindspore.offline_debug.convert_async";
|
||||
}
|
||||
|
||||
DIR *d_handle;
|
||||
d_handle = opendir(dump_key.c_str());
|
||||
DIR *d_handle = opendir(dump_key.c_str());
|
||||
if (d_handle != nullptr) {
|
||||
struct dirent *dir = nullptr;
|
||||
while ((dir = readdir(d_handle)) != NULL) {
|
||||
|
@ -758,7 +757,6 @@ void DebugServices::ReadDumpedTensor(std::vector<std::string> backend_name, std:
|
|||
continue;
|
||||
}
|
||||
std::size_t found = stripped_file_name.rfind(prefix_dump_file_name, 0);
|
||||
|
||||
if (found != 0) {
|
||||
continue;
|
||||
}
|
||||
|
@ -907,7 +905,6 @@ std::vector<std::shared_ptr<TensorData>> DebugServices::ReadNeededDumpedTensors(
|
|||
continue;
|
||||
}
|
||||
std::size_t found = stripped_file_name.rfind(dump_name, 0);
|
||||
|
||||
if (found == 0) {
|
||||
size_t slot = std::stoul(stripped_file_name.substr(dump_name.length() + 1));
|
||||
std::vector<int64_t> shape;
|
||||
|
|
|
@ -305,7 +305,7 @@ AnfNodePtr HyperMap::FullMake(const std::shared_ptr<Class> &type, const FuncGrap
|
|||
|
||||
auto call_node = func_graph->NewCNodeInOrder(inputs2);
|
||||
if (reverse_) {
|
||||
inputs.insert(inputs.begin() + 2, call_node);
|
||||
inputs.insert(inputs.begin() + kPrimAndTypeLen, call_node);
|
||||
} else {
|
||||
inputs.emplace_back(call_node);
|
||||
}
|
||||
|
|
|
@ -70,8 +70,9 @@ bool OnlyUsedByTwoNode(const AnfNodePtr &be_used_node, const AnfNodePtr &first_n
|
|||
if (iter == node_users.end()) {
|
||||
return false;
|
||||
}
|
||||
constexpr size_t partial_users_cnt = 2;
|
||||
auto &partial_users = iter->second;
|
||||
if (partial_users.size() != 2) {
|
||||
if (partial_users.size() != partial_users_cnt) {
|
||||
return false;
|
||||
}
|
||||
const auto &first_user = partial_users.front().first;
|
||||
|
|
|
@ -355,6 +355,5 @@ abstract::AbstractBasePtrList PrimBpropOptimizer::AddOutToAbsList(const ValuePtr
|
|||
new_abs_list.emplace_back(out_abs);
|
||||
return new_abs_list;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -1222,6 +1222,5 @@ AbstractBasePtr InferImplTensorCopySlices(const AnalysisEnginePtr &, const Primi
|
|||
AbstractTensorPtr input = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
|
||||
return std::make_shared<AbstractTensor>(input->element(), input->shape());
|
||||
}
|
||||
|
||||
} // namespace abstract
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -63,27 +63,19 @@ std::string GetTimeString() {
|
|||
time_t time_seconds = time(0);
|
||||
struct tm now_time;
|
||||
localtime_s(&now_time, &time_seconds);
|
||||
sprintf_s(buf, BUFLEN, "%d-%d-%d %d:%d:%d", now_time.tm_year + 1900, now_time.tm_mon + 1, now_time.tm_mday,
|
||||
now_time.tm_hour, now_time.tm_min, now_time.tm_sec);
|
||||
snprintf(buf, BUFLEN, "%d-%d-%d %d:%d:%d", now_time.tm_year + 1900, now_time.tm_mon + 1, now_time.tm_mday,
|
||||
now_time.tm_hour, now_time.tm_min, now_time.tm_sec);
|
||||
#else
|
||||
struct timeval cur_time;
|
||||
(void)gettimeofday(&cur_time, nullptr);
|
||||
|
||||
struct tm now;
|
||||
constexpr size_t time_str_len = 19;
|
||||
constexpr int64_t time_convert_unit = 1000;
|
||||
(void)localtime_r(&cur_time.tv_sec, &now);
|
||||
(void)strftime(buf, BUFLEN, "%Y-%m-%d-%H:%M:%S", &now); // format date and time
|
||||
// set micro-second
|
||||
buf[27] = '\0';
|
||||
int idx = 26;
|
||||
auto num = cur_time.tv_usec;
|
||||
constexpr int interval_number = 3;
|
||||
for (int i = 5; i >= 0; i--) {
|
||||
buf[idx--] = static_cast<char>(num % 10 + '0');
|
||||
num /= 10;
|
||||
if (i % interval_number == 0) {
|
||||
buf[idx--] = '.';
|
||||
}
|
||||
}
|
||||
snprintf(buf + time_str_len, BUFLEN - time_str_len, ".%03ld.%03ld", cur_time.tv_usec / time_convert_unit,
|
||||
cur_time.tv_usec % time_convert_unit);
|
||||
#endif
|
||||
return std::string(buf);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue