diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/ngram_op.cc b/mindspore/ccsrc/minddata/dataset/text/kernels/ngram_op.cc index b5240687316..d9b24eae454 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/ngram_op.cc +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/ngram_op.cc @@ -59,12 +59,12 @@ Status NgramOp::Compute(const std::shared_ptr &input, std::shared_ptr= 0, "Ngram: get offsets failed."); for (int ind = start_ind; ind < end_ind - n; ind++) { - res.emplace_back(str_buffer.substr(offsets[ind], offsets[ind + n] - offsets[ind] - separator_.size())); + (void)res.emplace_back(str_buffer.substr(offsets[ind], offsets[ind + n] - offsets[ind] - separator_.size())); } } } @@ -89,7 +89,7 @@ Status NgramOp::OutputShape(const std::vector &inputs, std::vector< // if len_with_padding - n < 0, this would return an empty string num_elements += std::max(len_with_padding - n, 0); } - outputs.emplace_back(TensorShape({num_elements})); + (void)outputs.emplace_back(TensorShape({num_elements})); CHECK_FAIL_RETURN_UNEXPECTED(outputs.size() == NumOutput(), "Ngram: incorrect num of outputs\n"); return Status::OK(); } diff --git a/mindspore/dataset/engine/datasets.py b/mindspore/dataset/engine/datasets.py index 444e78f7196..252622e3260 100644 --- a/mindspore/dataset/engine/datasets.py +++ b/mindspore/dataset/engine/datasets.py @@ -1752,6 +1752,7 @@ class Dataset: """Reset the dataset for next epoch.""" def is_shuffled(self): + """Returns True if the dataset or its children is shuffled.""" for input_dataset in self.children: if input_dataset.is_shuffled(): return True @@ -1759,6 +1760,7 @@ class Dataset: return False def is_sharded(self): + """Returns True if the dataset or its children is sharded.""" for input_dataset in self.children: if input_dataset.is_sharded(): return True diff --git a/mindspore/lite/micro/example/mnist_stm32f746/mnist_stm32f746/include/lite_utils.h b/mindspore/lite/micro/example/mnist_stm32f746/mnist_stm32f746/include/lite_utils.h index cf7a4d073fe..ec66f2222a0 100755 --- a/mindspore/lite/micro/example/mnist_stm32f746/mnist_stm32f746/include/lite_utils.h +++ b/mindspore/lite/micro/example/mnist_stm32f746/mnist_stm32f746/include/lite_utils.h @@ -149,7 +149,7 @@ class String { if (buffer_ == nullptr) { MS_C_EXCEPTION("malloc data failed"); } - strncpy(buffer_, other.buffer_ + pos, size_); + strncpy_s(buffer_, size_ + 1, other.buffer_ + pos, size_); buffer_[size_] = '\0'; } } @@ -269,7 +269,7 @@ class String { MS_C_EXCEPTION("malloc data failed"); } memcpy(tmp, this->buffer_, size_ + 1); - strncat(tmp, str.buffer_, str.size_); + strncat_s(tmp, new_size + 1, str.buffer_, str.size_); tmp[new_size] = '\0'; free(buffer_); buffer_ = tmp;