!3248 Alarm modification

Merge pull request !3248 from shenwei41/sw_master
This commit is contained in:
mindspore-ci-bot 2020-07-21 21:57:26 +08:00 committed by Gitee
commit cb67447651
8 changed files with 31 additions and 9 deletions

View File

@ -186,7 +186,7 @@ std::shared_ptr<ProjectDataset> Dataset::Project(const std::vector<std::string>
// Helper function to create default RandomSampler.
std::shared_ptr<SamplerObj> CreateDefaultSampler() {
int32_t num_samples = 0; // 0 means to sample all ids.
const int32_t num_samples = 0; // 0 means to sample all ids.
bool replacement = false;
return std::make_shared<RandomSamplerObj>(replacement, num_samples);
}

View File

@ -1157,8 +1157,8 @@ Status DEPipeline::ParseTFReaderOp(const py::dict &args, std::shared_ptr<Dataset
if (sampler) {
(void)builder->SetSampler(std::move(sampler));
} else if (cache_client) {
int64_t num_samples = 0;
int64_t start_index = 0;
const int64_t num_samples = 0;
const int64_t start_index = 0;
sampler = std::make_shared<SequentialSampler>(num_samples, start_index);
(void)builder->SetSampler(std::move(sampler));
}
@ -1511,8 +1511,8 @@ Status DEPipeline::ParseRandomDataOp(const py::dict &args, std::shared_ptr<Datas
if (sampler) {
(void)builder.SetSampler(std::move(sampler));
} else if (cache_client) {
int64_t num_samples = 0;
int64_t start_index = 0;
const int64_t num_samples = 0;
const int64_t start_index = 0;
sampler = std::make_shared<SequentialSampler>(num_samples, start_index);
(void)builder.SetSampler(std::move(sampler));
}

View File

@ -111,6 +111,7 @@ class BatchFetchRequest : public BaseRequest {
friend class CacheService;
BatchFetchRequest(connection_id_type connection_id, const std::vector<row_id_type> &row_id)
: BaseRequest(connection_id, RequestType::kBatchFetchRows), row_id_(row_id) {}
~BatchFetchRequest() = default;
Status RestoreRows(TensorTable *out);
private:
@ -130,6 +131,8 @@ class CreationCacheRequest : public BaseRequest {
CreateCacheFlag flag = CreateCacheFlag::kNone)
: BaseRequest(connection_id, RequestType::kCreateCache), cache_mem_sz(cache_mem_sz), flag_(flag) {}
~CreationCacheRequest() = default;
std::string cookie() const { return cookie_; }
private:
@ -142,6 +145,8 @@ class PurgeCacheRequest : public BaseRequest {
public:
friend class CacheServer;
explicit PurgeCacheRequest(connection_id_type connection_id) : BaseRequest(connection_id, RequestType::kPurgeCache) {}
~PurgeCacheRequest() = default;
};
/// \brief Request to destroy a cache
class DestroyCacheRequest : public BaseRequest {
@ -149,6 +154,9 @@ class DestroyCacheRequest : public BaseRequest {
friend class CacheServer;
explicit DestroyCacheRequest(connection_id_type connection_id)
: BaseRequest(connection_id, RequestType::kDestroyCache) {}
/// \brief Destructor
~DestroyCacheRequest() = default;
};
/// \brief Obtain the statistics of the current connection
class GetStatRequest : public BaseRequest {
@ -156,6 +164,9 @@ class GetStatRequest : public BaseRequest {
friend class CacheServer;
friend class CacheService;
explicit GetStatRequest(connection_id_type connection_id) : BaseRequest(connection_id, RequestType::kGetStat) {}
~GetStatRequest() = default;
row_id_type GetMinRowId() const {
auto *msg = flatbuffers::GetRoot<ServiceStatMsg>(mem_.GetPointer());
return msg->min_row_id();
@ -217,6 +228,8 @@ class BuildPhaseDoneRequest : public BaseRequest {
BuildPhaseDoneRequest(connection_id_type connection_id, const std::string &cookie)
: BaseRequest(connection_id, RequestType::kBuildPhaseDone), cookie_(cookie) {}
~BuildPhaseDoneRequest() = default;
private:
std::string cookie_;
};

View File

@ -35,6 +35,9 @@ class RepeatPass : public NodePass {
/// \brief Constructor
RepeatPass();
/// \brief Destructor
~RepeatPass() = default;
/// \brief Identifies the subtree below this node as being in a repeated path of the tree.
/// \param[in] node The node being visited
/// \param[inout] modified Indicator if the node was changed at all

View File

@ -67,8 +67,8 @@ Status CachePass::RunOnNode(std::shared_ptr<CacheOp> node, bool *modified) {
MS_LOG(INFO) << "Cache transform pass: Set up cache sampler from non-mappable leaf.";
} else {
// We're a cache op but no sampler was saved from leaf, so create a default sampler
int64_t num_samples = 0;
int64_t start_index = 0;
const int64_t num_samples = 0;
const int64_t start_index = 0;
sampler_ = std::make_shared<SequentialSampler>(num_samples, start_index);
node->SetSampler(std::move(sampler_));
MS_LOG(INFO) << "Cache transform pass: Creating default sequential sampler for cache op.";

View File

@ -36,6 +36,9 @@ class CachePass : public NodePass {
/// \param[in] transform_pass Raw pointer back to controlling tree pass
explicit CachePass(CacheTransformPass *transform_pass);
/// \brief Destructor
~CachePass() = default;
/// \brief Identifies the subtree below this node as a cached descendant tree.
/// \param[in] node The node being visited
/// \param[inout] modified Indicator if the node was changed at all

View File

@ -37,6 +37,9 @@ class CacheTransformPass : public TreePass {
/// \brief Constructor
CacheTransformPass();
/// \brief Destructor
~CacheTransformPass() = default;
/// \brief Runs a cache_pass first to set up the transformation nodes, and then drives any of these transformations
/// \param[inout] tree The tree to operate on.
/// \param[inout] Indicate of the tree was modified.

View File

@ -664,8 +664,8 @@ Status AutoContrast(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor
table.push_back(i);
}
} else {
float scale = 255.0 / (hi - lo);
float offset = -1 * lo * scale;
const float scale = 255.0 / (hi - lo);
const float offset = -1 * lo * scale;
for (int32_t i = 0; i < 256; i++) {
int32_t ix = static_cast<int32_t>(i * scale + offset);
ix = std::max(ix, 0);