forked from mindspore-Ecosystem/mindspore
!31547 code check clean
Merge pull request !31547 from liuyang/code_check
This commit is contained in:
commit
80fff8a86b
|
@ -236,7 +236,8 @@ uint32_t Fp32ToFp16(float value) {
|
|||
const unsigned int FP16_E = 16 - 1 - FP16_M;
|
||||
|
||||
uint32_t fp32_bits;
|
||||
std::memcpy(reinterpret_cast<std::byte *>(&fp32_bits), reinterpret_cast<std::byte *>(&value), sizeof(value));
|
||||
memcpy_s(reinterpret_cast<std::byte *>(&fp32_bits), sizeof(fp32_bits), reinterpret_cast<std::byte *>(&value),
|
||||
sizeof(value));
|
||||
|
||||
uint32_t mantissa = fp32_bits & FieldMask(FP32_M);
|
||||
uint32_t fp32_exp_mask = FieldMask(FP32_E);
|
||||
|
@ -623,8 +624,8 @@ struct LoopConditionInfo {
|
|||
condition expression before and inside Loop subgraph)
|
||||
The only while loop form supported currently is the one used in GNMT v2's Beam Search. Python example:
|
||||
i = begin
|
||||
while i < end:
|
||||
# ...
|
||||
while i < end
|
||||
...
|
||||
i += step
|
||||
To enable proper support for arbitrary while loop contitions, condition calculation should be duplicated inside the
|
||||
Loop supgraph. But exporting the same ops twice with different names is not currently supported.
|
||||
|
@ -2808,7 +2809,7 @@ void MakeLSTMWeight(const std::string &input, const std::string &output, const s
|
|||
auto split_o_name = output + "__concat_o";
|
||||
auto split_f_name = output + "__concat_f";
|
||||
auto split_c_name = output + "__concat_c";
|
||||
int64_t hidden_size = output_shape[1] / 4;
|
||||
int64_t hidden_size = output_shape[kOneNum] / kFourNum;
|
||||
AddSplitOp(reshaped_name, {split_i_name, split_f_name, split_c_name, split_o_name},
|
||||
{hidden_size, hidden_size, hidden_size, hidden_size}, 1, graph_proto);
|
||||
|
||||
|
|
|
@ -432,11 +432,11 @@ void DfGraphConvertor::BuildSaveCheckpointGraph() {
|
|||
size_t index = 0;
|
||||
string name;
|
||||
|
||||
int32_t count_size = std::count_if(vars_.begin(), vars_.end(), [](const auto &it) {
|
||||
return (it.second == nullptr || it.first.find("/") != std::string::npos);
|
||||
size_t count_size = std::count_if(vars_.begin(), vars_.end(), [](const auto &it) {
|
||||
return LongToUlong(it.second == nullptr || it.first.find("/") != std::string::npos);
|
||||
});
|
||||
|
||||
(void)save_op.create_dynamic_input_tensors(vars_.size() - static_cast<size_t>(count_size));
|
||||
(void)save_op.create_dynamic_input_tensors(static_cast<uint32_t>(vars_.size() - count_size));
|
||||
|
||||
// for each "parameter" in anf graph excluding "input"
|
||||
for (const auto &it : vars_) {
|
||||
|
@ -444,7 +444,7 @@ void DfGraphConvertor::BuildSaveCheckpointGraph() {
|
|||
if (it.second == nullptr || name.find("/") != std::string::npos) continue;
|
||||
Variable variable(name);
|
||||
(void)variable.update_output_desc_y(it.second->GetOutputDesc(0));
|
||||
(void)save_op.set_dynamic_input_tensors(index++, variable);
|
||||
(void)save_op.set_dynamic_input_tensors(static_cast<uint32_t>(index++), variable);
|
||||
|
||||
graph_inputs.push_back(variable);
|
||||
|
||||
|
@ -818,7 +818,7 @@ void DfGraphConvertor::GetCaseNodeInput(const CNodePtr node, const CNodePtr inpu
|
|||
tuple_items->push_back(out_handle_cache_[item.get()]);
|
||||
} else {
|
||||
MS_LOG(DEBUG) << "Add an empty out handler: " << item->ToString();
|
||||
tuple_items->push_back(OutHandler());
|
||||
tuple_items->emplace_back(OutHandler());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1508,7 +1508,7 @@ void DfGraphConvertor::ConvertMakeTuple(const CNodePtr node) {
|
|||
} else if (out_handle_cache_.find(item.get()) != out_handle_cache_.end()) {
|
||||
tuple_items->push_back(out_handle_cache_[item.get()]);
|
||||
} else {
|
||||
tuple_items->push_back(OutHandler(nullptr, "", item));
|
||||
tuple_items->emplace_back(OutHandler(nullptr, "", item));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1667,7 +1667,7 @@ OutHandler DfGraphConvertor::GetHandler(const AnfNodePtr &node, const std::stack
|
|||
return OutHandler(nullptr, "");
|
||||
}
|
||||
op_draw_name_[draw_index] = ss.str();
|
||||
return adpt->getOutput(Convert(node), UintToInt(index_stack.top()));
|
||||
return adpt->getOutput(Convert(node), static_cast<int32_t>(index_stack.top()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ GraphRunner::GraphRunner(const GraphRunnerOptions &options)
|
|||
}
|
||||
MS_LOG(INFO) << "Add the graph " << (*it).name_ << " to GE, it's id is: " << (*it).id_;
|
||||
graph_manager_.AddSavedGraphs(std::to_string(it->id_));
|
||||
(void)sess_->AddGraph(it->id_, *(it->graph_ptr_), it->options_);
|
||||
(void)sess_->AddGraph(static_cast<uint32_t>(it->id_), *(it->graph_ptr_), it->options_);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ Status GraphRunner::RunGraph(const RunOptions &options, const std::vector<GeTens
|
|||
MS_LOG(ERROR) << "The GE session is null, can't run the graph!";
|
||||
return Status::FAILED;
|
||||
}
|
||||
ge::Status ret = sess_->RunGraph(wrap_ptr->id_, ge_inputs, ge_outputs);
|
||||
ge::Status ret = sess_->RunGraph(static_cast<uint32_t>(wrap_ptr->id_), ge_inputs, ge_outputs);
|
||||
if (ret != ge::GRAPH_SUCCESS) {
|
||||
MS_LOG(ERROR) << "Call GE RunGraph Failed, ret is: " << ret;
|
||||
return Status::FAILED;
|
||||
|
|
Loading…
Reference in New Issue