clean code for r1.8

This commit is contained in:
changzherui 2022-08-04 22:50:34 +08:00
parent 70d8d9dcd1
commit c6ba5e3a72
4 changed files with 10 additions and 6 deletions

View File

@ -986,7 +986,7 @@ void DfGraphConvertor::BuildWhileSubGraph() {
graph_name += "_body_graph";
graph_out = GetWhileBodyOutputs();
}
if (error_ == 0) {
if (error_ == SUCCESS) {
if (df_graph_->GetName() != graph_name) {
MS_LOG(DEBUG) << "convert anf graph name : " << df_graph_->GetName() << " to df graph name: " << graph_name;
}

View File

@ -206,7 +206,7 @@ GeTensorPtr ConvertStringTensor(const MeTensorPtr &tensor, const std::string &fo
char *string_element = new char[string_max_length];
size_t string_length = 0;
for (size_t i = 0; i < elements_num; i++) {
std::fill_n(string_element, string_max_length, '\0');
(void)std::fill_n(string_element, string_max_length, '\0');
for (size_t j = 0; j < string_max_length; j++) {
char char_element = data_ptr[i * string_max_length * single_char_offset + single_char_offset * j];
if (static_cast<int>(char_element) == 0) {

View File

@ -468,6 +468,10 @@ def ms_function(fn=None, input_signature=None, hash_args=None, jit_config=None):
This allows the MindSpore runtime to apply optimizations based on graph.
Note:
If `input_signature` is specified, each input of `fn` must be a Tensor. And the input arguments for `fn`
will not accept `**kwargs`.
Args:
fn (Function): The Python function that will be run as a graph. Default: None.
input_signature (Tensor): The Tensor which describes the input arguments. The shape and dtype of the Tensor

View File

@ -713,7 +713,7 @@ class Model:
dataset_helper.continue_send()
self._eval_durning_train(valid_infos, cb_params, list_callback)
self._eval_during_train(valid_infos, cb_params, list_callback)
# In disaster recovery scenarios, need not to execute callbacks if this epoch executes failed.
# Embedding cache server need not do epoch end callback, this process only run one step.
@ -742,8 +742,8 @@ class Model:
list_callback.on_train_end(run_context)
def _eval_durning_train(self, valid_infos, cb_params, list_callback):
"""Exec eval durnning train process."""
def _eval_during_train(self, valid_infos, cb_params, list_callback):
"""Exec eval during train process."""
valid_dataset, valid_frequency, valid_dataset_sink_mode = valid_infos
if valid_dataset and self._should_eval(cb_params.cur_epoch_num, valid_frequency):
train_cur_step_num = cb_params.cur_step_num
@ -921,7 +921,7 @@ class Model:
if should_stop:
break
self._eval_durning_train(valid_infos, cb_params, list_callback)
self._eval_during_train(valid_infos, cb_params, list_callback)
train_dataset.reset()