forked from mindspore-Ecosystem/mindspore
!39173 clean code
Merge pull request !39173 from huangbingjian/clean_code
This commit is contained in:
commit
eb0929f855
|
@ -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_;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue