Browse Source

!3248 Alarm modification

Merge pull request !3248 from shenwei41/sw_master
tags/v0.6.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
cb67447651
8 changed files with 31 additions and 9 deletions
  1. +1
    -1
      mindspore/ccsrc/minddata/dataset/api/datasets.cc
  2. +4
    -4
      mindspore/ccsrc/minddata/dataset/api/de_pipeline.cc
  3. +13
    -0
      mindspore/ccsrc/minddata/dataset/engine/cache/cache_request.h
  4. +3
    -0
      mindspore/ccsrc/minddata/dataset/engine/opt/post/repeat_pass.h
  5. +2
    -2
      mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.cc
  6. +3
    -0
      mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.h
  7. +3
    -0
      mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_transform_pass.h
  8. +2
    -2
      mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc

+ 1
- 1
mindspore/ccsrc/minddata/dataset/api/datasets.cc 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);
}


+ 4
- 4
mindspore/ccsrc/minddata/dataset/api/de_pipeline.cc 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));
}


+ 13
- 0
mindspore/ccsrc/minddata/dataset/engine/cache/cache_request.h 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_;
};


+ 3
- 0
mindspore/ccsrc/minddata/dataset/engine/opt/post/repeat_pass.h 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


+ 2
- 2
mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.cc 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.";


+ 3
- 0
mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.h 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


+ 3
- 0
mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_transform_pass.h 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.


+ 2
- 2
mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc 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);


Loading…
Cancel
Save