!6533 Fix code warning

Merge pull request !6533 from ZPaC/master-fix-code-warning
This commit is contained in:
mindspore-ci-bot 2020-09-19 20:01:27 +08:00 committed by Gitee
commit 97c3127944
2 changed files with 5 additions and 2 deletions

View File

@ -122,6 +122,9 @@ int Util::LocalShard(int first_dim, int rank_id, int server_num) {
}
std::map<int, int> Util::AllRankLocalShard(int first_dim, int rank_id, int server_num) {
if (first_dim <= 0 || server_num <= 0 || rank_id < 0) {
MS_LOG(EXCEPTION) << "Input values are invalid.";
}
if (rank_id >= server_num) {
MS_LOG(EXCEPTION) << "The rank ID " << rank_id << " should be less than the number of servers " << server_num;
}

View File

@ -548,8 +548,8 @@ void WorkerProxy<T>::PrepareSparseGradient(const size_t begin, const size_t end,
int offset = 0;
int index = 0;
size_t segment_data_size = segment_size * sizeof(T);
size_t dst_size = 0;
size_t src_size = 0;
size_t dst_size;
size_t src_size;
void *dst_data = nullptr;
void *src_data = nullptr;
for (auto &pair : indice_to_grads) {