clean code warnings
This commit is contained in:
parent
41645b7d1b
commit
e25ae03d37
|
@ -14,3 +14,4 @@ followings
|
|||
functionAble
|
||||
Aline
|
||||
allEdges
|
||||
FillD
|
||||
|
|
|
@ -145,7 +145,8 @@ void EmbeddingCacheTableManager::AllocMemForEmbedding(const device::DeviceContex
|
|||
auto *device_address = item.second.device_address;
|
||||
MS_EXCEPTION_IF_NULL(device_address);
|
||||
if (device_address->GetPtr() == nullptr) {
|
||||
device_context->device_res_manager_->AllocateMemory(device_address);
|
||||
MS_EXCEPTION_IF_CHECK_FAIL(device_context->device_res_manager_->AllocateMemory(device_address),
|
||||
"Allocate device memory for embedding table failed.");
|
||||
}
|
||||
item.second.address = Address(device_address->GetMutablePtr(), device_address->GetSize());
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ void LocalFile<KeyType, ValueType>::Write(const ConstDataWithLen &keys, const Co
|
|||
auto block_file_ptr = fs_->CreateWriteFile(block_file_name, "wb+");
|
||||
MS_EXCEPTION_IF_NULL(block_file_ptr);
|
||||
MS_EXCEPTION_IF_CHECK_FAIL(block_file_ptr->Trunc(block_size_ * element_len), "Truncate file failed.");
|
||||
block_files_.emplace_back(block_file_ptr);
|
||||
(void)block_files_.emplace_back(block_file_ptr);
|
||||
|
||||
// Reset offset cursor in block.
|
||||
current_offset_in_block_ = 0;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#include "utils/log_adapter.h"
|
||||
|
@ -1351,6 +1352,8 @@ COMMON_EXPORT size_t GetSystemMemorySize(const std::string &key);
|
|||
// Key is the output index while the value is input index which will be used as the reference of output.
|
||||
using OutputInputRefMap = std::map<size_t, size_t>;
|
||||
|
||||
using HashTableExportData = std::vector<std::shared_ptr<std::vector<char>>>;
|
||||
|
||||
static inline uint64_t GetCurrentUSec() {
|
||||
auto time_now = std::chrono::system_clock::now();
|
||||
auto tv_usec = std::chrono::duration_cast<std::chrono::microseconds>(time_now.time_since_epoch()).count();
|
||||
|
|
|
@ -27,12 +27,12 @@ namespace device {
|
|||
namespace cpu {
|
||||
template <typename Key, typename Value>
|
||||
CPUHashTable<Key, Value>::CPUHashTable(size_t value_dim) : value_dim_(value_dim), value_size_(0) {
|
||||
Initialize();
|
||||
(void)Initialize();
|
||||
}
|
||||
|
||||
template <typename Key, typename Value>
|
||||
CPUHashTable<Key, Value>::~CPUHashTable() {
|
||||
Finalize();
|
||||
(void)Finalize();
|
||||
}
|
||||
|
||||
template <typename Key, typename Value>
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
namespace mindspore {
|
||||
namespace device {
|
||||
namespace cpu {
|
||||
using mindspore::HashTableExportData;
|
||||
|
||||
// A hash table base on the host side cpu.
|
||||
template <typename Key, typename Value>
|
||||
class CPUHashTable : public HashTable<Key, Value> {
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#include <string>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include "include/common/utils/utils.h"
|
||||
|
||||
namespace mindspore {
|
||||
using DataLenPair = std::pair<void *, size_t>;
|
||||
using HashTableExportData = std::vector<std::shared_ptr<std::vector<char>>>;
|
||||
|
||||
enum class HashTableElementStatus {
|
||||
kUnchanged = 0,
|
||||
|
@ -40,7 +40,7 @@ class HashTable {
|
|||
virtual ~HashTable() = default;
|
||||
|
||||
// Find elements with specific keys, if a key does not exist, initialize the value for the key based on the
|
||||
// initialzer and insert the key-value pair into map. The initializer can be 'normal', 'zero' or 'one', and also
|
||||
// initializer and insert the key-value pair into map. The initializer can be 'normal', 'zero' or 'one', and also
|
||||
// could be a specific Value type scalar.
|
||||
virtual bool Find(const Key *keys, size_t key_num, bool insert_default_value, Value *outputs, void *stream) = 0;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
namespace mindspore {
|
||||
namespace runtime {
|
||||
bool DeviceSparseEmbeddingOperation::Initialize() {
|
||||
DeviceEmbeddingOperation::Initialize();
|
||||
RETURN_IF_FALSE_WITH_LOG(DeviceEmbeddingOperation::Initialize(), "Initialize device embedding operation failed.");
|
||||
BuildEmbeddingCacheEraseKernel();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
#include "ir/scalar.h"
|
||||
#include "mindapi/base/macros.h"
|
||||
#include "utils/shape_utils.h"
|
||||
#include "include/common/utils/utils.h"
|
||||
|
||||
namespace mindspore {
|
||||
using HashTableExportData = std::vector<std::shared_ptr<std::vector<char>>>;
|
||||
namespace tensor {
|
||||
class MapTensor;
|
||||
// Smart pointer for MapTensor.
|
||||
|
|
Loading…
Reference in New Issue