Merge pull request !39173 from huangbingjian/clean_code
This commit is contained in:
i-robot 2022-07-30 12:04:56 +00:00 committed by Gitee
commit eb0929f855
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 5 additions and 7 deletions

View File

@ -21,7 +21,6 @@
#include <memory>
#include <vector>
#include <map>
#include <utility>
#include <sstream>
#include "utils/overload.h"
@ -88,7 +87,9 @@ class COMMON_EXPORT ConfigManager {
DatasetMode dataset_mode() const { return dataset_mode_; }
void set_dataset_mode(DatasetMode mode) { dataset_mode_ = mode; }
int64_t iter_num() const {
if (dataset_mode_ == DS_NORMAL_MODE) return 1;
if (dataset_mode_ == DS_NORMAL_MODE) {
return 1;
}
return iter_num_;
}

View File

@ -20,7 +20,6 @@
#define MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_CSE_H_
#include <vector>
#include <memory>
#include "utils/hash_map.h"
#include "ir/anf.h"
#include "ir/manager.h"

View File

@ -16,7 +16,6 @@
#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_CALLBACKS_GE_H_
#define MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_CALLBACKS_GE_H_
#include <map>
#include <vector>
#include <string>
#include <memory>
#include "include/transform/graph_ir/types.h"

View File

@ -598,8 +598,7 @@ TensorDataPtr MakeTensorData(TypeId data_type, Args &&... args) {
}
TensorDataPtr MakeTensorSubData(const TensorPtr &owner, size_t offset, const TensorDataPtr &data) {
const size_t data_bytes = data->nbytes();
if (data_bytes == 0) {
if (data->nbytes() == 0) {
MS_LOG(EXCEPTION) << "Tensor data size is 0.";
}
auto sub_data = MakeTensorData<TensorSubDataImpl>(owner->data_type(), owner, offset, data->size(), data->ndim());
@ -941,7 +940,7 @@ TensorPtrList Tensor::FlattenTensors(const TensorPtrList &tensors, size_t fusion
size_t offset = 0;
for (auto &tensor : chunk.tensors) {
auto sub_data = MakeTensorSubData(chunk_tensor, offset, tensor->data_ptr());
offset += sub_data->nbytes();
offset += static_cast<size_t>(sub_data->nbytes());
tensor->data_ = sub_data;
}
// Save chunk tensor to result list.