Browse Source

fix pclint

tags/v1.6.0
Xiao Tianci 4 years ago
parent
commit
af632561be
21 changed files with 55 additions and 53 deletions
  1. +9
    -9
      mindspore/ccsrc/minddata/dataset/api/audio.cc
  2. +1
    -1
      mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lfilter_ir.cc
  3. +1
    -1
      mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lfilter_ir.h
  4. +1
    -1
      mindspore/ccsrc/minddata/dataset/audio/ir/kernels/time_masking_ir.h
  5. +1
    -1
      mindspore/ccsrc/minddata/dataset/audio/kernels/time_masking_op.cc
  6. +6
    -7
      mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h
  7. +3
    -3
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/coco_op.cc
  8. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/usps_node.cc
  9. +2
    -2
      mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/usps_node.h
  10. +6
    -5
      mindspore/ccsrc/minddata/dataset/engine/serdes.cc
  11. +6
    -5
      mindspore/ccsrc/minddata/dataset/engine/serdes.h
  12. +1
    -1
      mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc
  13. +1
    -1
      mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.h
  14. +1
    -1
      mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.cc
  15. +2
    -1
      mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.h
  16. +1
    -2
      mindspore/ccsrc/minddata/dataset/kernels/ir/data/transforms_ir.cc
  17. +1
    -1
      mindspore/ccsrc/minddata/dataset/kernels/ir/data/transforms_ir.h
  18. +3
    -2
      mindspore/ccsrc/minddata/dataset/kernels/ir/vision/random_rotation_ir.cc
  19. +2
    -2
      mindspore/ccsrc/minddata/dataset/kernels/ir/vision/random_rotation_ir.h
  20. +2
    -2
      mindspore/ccsrc/minddata/dataset/kernels/ir/vision/rotate_ir.cc
  21. +4
    -4
      mindspore/ccsrc/minddata/dataset/kernels/ir/vision/rotate_ir.h

+ 9
- 9
mindspore/ccsrc/minddata/dataset/api/audio.cc View File

@@ -192,8 +192,8 @@ std::shared_ptr<TensorOperation> Contrast::Parse() {
// DCShift Transform Operation.
struct DCShift::Data {
Data(float shift, float limiter_gain) : shift_(shift), limiter_gain_(limiter_gain) {}
float limiter_gain_;
float shift_;
float limiter_gain_;
};
DCShift::DCShift(float shift) : data_(std::make_shared<Data>(shift, shift)) {}
@@ -256,9 +256,9 @@ struct FrequencyMasking::Data {
frequency_mask_param_(frequency_mask_param),
mask_start_(mask_start),
mask_value_(mask_value) {}
bool iid_masks_;
int32_t frequency_mask_param_;
int32_t mask_start_;
bool iid_masks_;
float mask_value_;
};
@@ -328,11 +328,11 @@ std::shared_ptr<TensorOperation> Magphase::Parse() { return std::make_shared<Mag
// MuLawDecoding Transform Operation.
struct MuLawDecoding::Data {
explicit Data(int quantization_channels) : quantization_channels_(quantization_channels) {}
int quantization_channels_;
explicit Data(int32_t quantization_channels) : quantization_channels_(quantization_channels) {}
int32_t quantization_channels_;
};
MuLawDecoding::MuLawDecoding(int quantization_channels) : data_(std::make_shared<Data>(quantization_channels)) {}
MuLawDecoding::MuLawDecoding(int32_t quantization_channels) : data_(std::make_shared<Data>(quantization_channels)) {}
std::shared_ptr<TensorOperation> MuLawDecoding::Parse() {
return std::make_shared<MuLawDecodingOperation>(data_->quantization_channels_);
@@ -342,9 +342,9 @@ std::shared_ptr<TensorOperation> MuLawDecoding::Parse() {
struct TimeMasking::Data {
Data(bool iid_masks, int32_t time_mask_param, int32_t mask_start, float mask_value)
: iid_masks_(iid_masks), time_mask_param_(time_mask_param), mask_start_(mask_start), mask_value_(mask_value) {}
bool iid_masks_;
int32_t time_mask_param_;
int32_t mask_start_;
bool iid_masks_;
float mask_value_;
};
@@ -358,14 +358,14 @@ std::shared_ptr<TensorOperation> TimeMasking::Parse() {
// TimeStretch Transform Operation.
struct TimeStretch::Data {
explicit Data(float hop_length, int n_freq, float fixed_rate)
explicit Data(float hop_length, int32_t n_freq, float fixed_rate)
: hop_length_(hop_length), n_freq_(n_freq), fixed_rate_(fixed_rate) {}
float hop_length_;
int n_freq_;
int32_t n_freq_;
float fixed_rate_;
};
TimeStretch::TimeStretch(float hop_length, int n_freq, float fixed_rate)
TimeStretch::TimeStretch(float hop_length, int32_t n_freq, float fixed_rate)
: data_(std::make_shared<Data>(hop_length, n_freq, fixed_rate)) {}
std::shared_ptr<TensorOperation> TimeStretch::Parse() {


+ 1
- 1
mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lfilter_ir.cc View File

@@ -23,7 +23,7 @@ namespace mindspore {
namespace dataset {
namespace audio {
// LFilterOperation
LFilterOperation::LFilterOperation(std::vector<float> a_coeffs, std::vector<float> b_coeffs, bool clamp)
LFilterOperation::LFilterOperation(const std::vector<float> &a_coeffs, const std::vector<float> &b_coeffs, bool clamp)
: a_coeffs_(a_coeffs), b_coeffs_(b_coeffs), clamp_(clamp) {}
Status LFilterOperation::ValidateParams() {


+ 1
- 1
mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lfilter_ir.h View File

@@ -35,7 +35,7 @@ constexpr char kLFilterOperation[] = "LFilter";
class LFilterOperation : public TensorOperation {
public:
LFilterOperation(std::vector<float> a_coeffs, std::vector<float> b_coeffs, bool clamp);
LFilterOperation(const std::vector<float> &a_coeffs, const std::vector<float> &b_coeffs, bool clamp);
~LFilterOperation() = default;


+ 1
- 1
mindspore/ccsrc/minddata/dataset/audio/ir/kernels/time_masking_ir.h View File

@@ -44,9 +44,9 @@ class TimeMaskingOperation : public TensorOperation {
Status to_json(nlohmann::json *out_json) override;

private:
bool iid_masks_;
int32_t time_mask_param_;
int32_t mask_start_;
bool iid_masks_;
float mask_value_;
}; // class TimeMaskingOperation



+ 1
- 1
mindspore/ccsrc/minddata/dataset/audio/kernels/time_masking_op.cc View File

@@ -24,7 +24,7 @@ namespace mindspore {
namespace dataset {
// constructor
TimeMaskingOp::TimeMaskingOp(bool iid_masks, int32_t time_mask_param, int32_t mask_start, float mask_value)
: time_mask_param_(time_mask_param), mask_start_(mask_start), iid_masks_(iid_masks), mask_value_(mask_value) {
: iid_masks_(iid_masks), time_mask_param_(time_mask_param), mask_start_(mask_start), mask_value_(mask_value) {
rnd_.seed(GetSeed());
}



+ 6
- 7
mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h View File

@@ -164,7 +164,6 @@ class DeviceQueueOp : public PipelineOp {
// Detect the cost time of each batch, present alarm message if cost too long
void DetectPerBatchTime(uint64_t *start_time, uint64_t *end_time);
#endif
std::atomic<bool> first_fetch_flag_;

std::unique_ptr<ChildIterator> child_iterator_;
std::string channel_name_;
@@ -173,20 +172,20 @@ class DeviceQueueOp : public PipelineOp {
const int32_t prefetch_size_;
const bool send_epoch_end_;
bool stop_send_;
bool send_finished_;
int32_t total_batch_;
bool create_data_info_queue_;
std::unique_ptr<DATA_INFO_QUEUE> data_info_queue_ptr_;
std::atomic<bool> first_fetch_flag_;
std::mutex data_info_mutex_;
bool send_finished_;
#ifdef ENABLE_DUMP_IR
std::shared_ptr<MDChannelInfo> md_channel_info_;
#endif
bool first_push_flag_; // default: false, when first push, it will be true

#ifdef ENABLE_TDTQUE
std::shared_ptr<TdtPlugin> tdtInstancePtr;
#endif

bool first_push_flag_; // default: false, when first push, it will be true
#ifdef ENABLE_DUMP_IR
std::shared_ptr<MDChannelInfo> md_channel_info_;
#endif
};
} // namespace dataset
} // namespace mindspore


+ 3
- 3
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/coco_op.cc View File

@@ -155,7 +155,7 @@ Status CocoOp::LoadDetectionTensorRow(row_id_type row_id, const std::string &ima
if (extra_metadata_) {
std::string img_id;
size_t pos = image_id.find(".");
if (pos == image_id.npos) {
if (pos == std::string::npos) {
RETURN_STATUS_UNEXPECTED("Invalid data, image : " + image_id + ", should be with suffix like \".jpg\"");
}
std::copy(image_id.begin(), image_id.begin() + pos, std::back_inserter(img_id));
@@ -188,7 +188,7 @@ Status CocoOp::LoadSimpleTensorRow(row_id_type row_id, const std::string &image_
if (extra_metadata_) {
std::string img_id;
size_t pos = image_id.find(".");
if (pos == image_id.npos) {
if (pos == std::string::npos) {
RETURN_STATUS_UNEXPECTED("Invalid data, image : " + image_id + ", should be with suffix like \".jpg\"");
}
std::copy(image_id.begin(), image_id.begin() + pos, std::back_inserter(img_id));
@@ -239,7 +239,7 @@ Status CocoOp::LoadMixTensorRow(row_id_type row_id, const std::string &image_id,
if (extra_metadata_) {
std::string img_id;
size_t pos = image_id.find(".");
if (pos == image_id.npos) {
if (pos == std::string::npos) {
RETURN_STATUS_UNEXPECTED("Invalid data, image : " + image_id + ", should be with suffix like \".jpg\"");
}
std::copy(image_id.begin(), image_id.begin() + pos, std::back_inserter(img_id));


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/usps_node.cc View File

@@ -27,7 +27,7 @@
namespace mindspore {
namespace dataset {
USPSNode::USPSNode(std::string dataset_dir, std::string usage, int32_t num_samples, ShuffleMode shuffle,
USPSNode::USPSNode(const std::string &dataset_dir, const std::string &usage, int32_t num_samples, ShuffleMode shuffle,
int32_t num_shards, int32_t shard_id, std::shared_ptr<DatasetCache> cache)
: NonMappableSourceNode(std::move(cache)),
dataset_dir_(dataset_dir),


+ 2
- 2
mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/usps_node.h View File

@@ -29,8 +29,8 @@ namespace dataset {
class USPSNode : public NonMappableSourceNode {
public:
/// \brief Constructor.
USPSNode(std::string dataset_dir, std::string usage, int32_t num_samples, ShuffleMode shuffle, int32_t num_shards,
int32_t shard_id, std::shared_ptr<DatasetCache> cache);
USPSNode(const std::string &dataset_dir, const std::string &usage, int32_t num_samples, ShuffleMode shuffle,
int32_t num_shards, int32_t shard_id, std::shared_ptr<DatasetCache> cache);
/// \brief Destructor.
~USPSNode() = default;


+ 6
- 5
mindspore/ccsrc/minddata/dataset/engine/serdes.cc View File

@@ -83,7 +83,7 @@ Status Serdes::SaveJSONToFile(nlohmann::json json_string, const std::string &fil
return Status::OK();
}

Status Serdes::Deserialize(std::string json_filepath, std::shared_ptr<DatasetNode> *ds) {
Status Serdes::Deserialize(const std::string &json_filepath, std::shared_ptr<DatasetNode> *ds) {
nlohmann::json json_obj;
CHECK_FAIL_RETURN_UNEXPECTED(json_filepath.size() != 0, "Json path is null");
std::ifstream json_in(json_filepath);
@@ -130,7 +130,7 @@ Status Serdes::ConstructPipeline(nlohmann::json json_obj, std::shared_ptr<Datase
return Status::OK();
}

Status Serdes::CreateNode(std::shared_ptr<DatasetNode> child_ds, nlohmann::json json_obj,
Status Serdes::CreateNode(const std::shared_ptr<DatasetNode> &child_ds, nlohmann::json json_obj,
std::shared_ptr<DatasetNode> *ds) {
CHECK_FAIL_RETURN_UNEXPECTED(json_obj.find("op_type") != json_obj.end(), "Failed to find op_type in json.");
std::string op_type = json_obj["op_type"];
@@ -144,7 +144,8 @@ Status Serdes::CreateNode(std::shared_ptr<DatasetNode> child_ds, nlohmann::json
return Status::OK();
}

Status Serdes::CreateDatasetNode(nlohmann::json json_obj, std::string op_type, std::shared_ptr<DatasetNode> *ds) {
Status Serdes::CreateDatasetNode(const nlohmann::json &json_obj, const std::string &op_type,
std::shared_ptr<DatasetNode> *ds) {
if (op_type == kAlbumNode) {
RETURN_IF_NOT_OK(AlbumNode::from_json(json_obj, ds));
} else if (op_type == kCelebANode) {
@@ -179,8 +180,8 @@ Status Serdes::CreateDatasetNode(nlohmann::json json_obj, std::string op_type, s
return Status::OK();
}

Status Serdes::CreateDatasetOperationNode(std::shared_ptr<DatasetNode> ds, nlohmann::json json_obj, std::string op_type,
std::shared_ptr<DatasetNode> *result) {
Status Serdes::CreateDatasetOperationNode(const std::shared_ptr<DatasetNode> &ds, const nlohmann::json &json_obj,
const std::string &op_type, std::shared_ptr<DatasetNode> *result) {
if (op_type == kBatchNode) {
RETURN_IF_NOT_OK(BatchNode::from_json(json_obj, ds, result));
} else if (op_type == kMapNode) {


+ 6
- 5
mindspore/ccsrc/minddata/dataset/engine/serdes.h View File

@@ -158,7 +158,7 @@ class Serdes {
/// \param[in] json_filepath input path of json file
/// \param[out] ds The deserialized dataset
/// \return Status The status code returned
static Status Deserialize(std::string json_filepath, std::shared_ptr<DatasetNode> *ds);
static Status Deserialize(const std::string &json_filepath, std::shared_ptr<DatasetNode> *ds);

/// \brief Helper function to construct IR tree, separate zip and other operations
/// \param[in] json_obj The JSON object to be deserialized
@@ -198,7 +198,7 @@ class Serdes {
/// \param[in] json_obj json object to read out type of the node
/// \param[out] ds Shared pointer of a DatasetNode object containing the deserialized IR tree
/// \return create new node based on the input dataset and type of the operation
static Status CreateNode(std::shared_ptr<DatasetNode> child_ds, nlohmann::json json_obj,
static Status CreateNode(const std::shared_ptr<DatasetNode> &child_ds, nlohmann::json json_obj,
std::shared_ptr<DatasetNode> *ds);

/// \brief Helper functions for creating dataset nodes, separate different datasets and call the related function
@@ -206,15 +206,16 @@ class Serdes {
/// \param[in] op_type type of dataset
/// \param[out] ds Shared pointer of a DatasetNode object containing the deserialized IR tree
/// \return Status The status code returned
static Status CreateDatasetNode(nlohmann::json json_obj, std::string op_type, std::shared_ptr<DatasetNode> *ds);
static Status CreateDatasetNode(const nlohmann::json &json_obj, const std::string &op_type,
std::shared_ptr<DatasetNode> *ds);

/// \brief Helper functions for creating operation nodes, separate different operations and call the related function
/// \param[in] json_obj The JSON object to be deserialized
/// \param[in] op_type type of dataset
/// \param[out] result Shared pointer of a DatasetNode object containing the deserialized IR tree
/// \return Status The status code returned
static Status CreateDatasetOperationNode(std::shared_ptr<DatasetNode> ds, nlohmann::json json_obj,
std::string op_type, std::shared_ptr<DatasetNode> *result);
static Status CreateDatasetOperationNode(const std::shared_ptr<DatasetNode> &ds, const nlohmann::json &json_obj,
const std::string &op_type, std::shared_ptr<DatasetNode> *result);

/// \brief Helper function to map the function pointers
/// \return map of key to function pointer


+ 1
- 1
mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc View File

@@ -1622,7 +1622,7 @@ bool GetAffineTransform(std::vector<Point> src_point, std::vector<Point> dst_poi
return true;
}

bool ConvertRgbToBgr(const LiteMat &src, LDataType data_type, int w, int h, LiteMat &mat) {
bool ConvertRgbToBgr(const LiteMat &src, const LDataType &data_type, int w, int h, LiteMat &mat) {
if (data_type == LDataType::UINT8) {
if (src.IsEmpty()) {
return false;


+ 1
- 1
mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.h View File

@@ -280,7 +280,7 @@ bool Sobel(const LiteMat &src, LiteMat &dst, int flag_x, int flag_y, int ksize =
/// \param[in] w The width of output image.
/// \param[in] h The height of output image.
/// \param[in] mat Output image data.
bool ConvertRgbToBgr(const LiteMat &src, LDataType data_type, int w, int h, LiteMat &mat);
bool ConvertRgbToBgr(const LiteMat &src, const LDataType &data_type, int w, int h, LiteMat &mat);

/// \brief Convert RGB image or color image to grayscale image.
/// \param[in] src Input image data.


+ 1
- 1
mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.cc View File

@@ -236,7 +236,7 @@ void LiteMat::Init(int width, int height, void *p_data, LDataType data_type) {
steps_[0] = width_ * steps_[1];
}

void LiteMat::Init(int width, int height, int channel, LDataType data_type, bool align_memory) {
void LiteMat::Init(int width, int height, int channel, const LDataType &data_type, bool align_memory) {
Release();
data_type_ = data_type;
InitElemSize(data_type);


+ 2
- 1
mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.h View File

@@ -229,7 +229,8 @@ class LiteMat {
// @param channel set channel for given LiteMat.
// @param data_type set data type for given LiteMat.
// @param align_memory whether malloc align memory or not, default is true, which is better for doing acceleration.
void Init(int width, int height, int channel, LDataType data_type = LDataType::UINT8, bool align_memory = true);
void Init(int width, int height, int channel, const LDataType &data_type = LDataType::UINT8,
bool align_memory = true);

void Init(int width, int height, int channel, void *p_data, LDataType data_type = LDataType::UINT8);



+ 1
- 2
mindspore/ccsrc/minddata/dataset/kernels/ir/data/transforms_ir.cc View File

@@ -15,7 +15,6 @@
*/

#include <algorithm>
#include <typeinfo>
#include <utility>

#include "minddata/dataset/kernels/ir/data/transforms_ir.h"
@@ -144,7 +143,7 @@ Status FillOperation::from_json(nlohmann::json op_params, std::shared_ptr<Tensor
}

// MaskOperation
MaskOperation::MaskOperation(RelationalOp op, const std::shared_ptr<Tensor> &constant, DataType dtype)
MaskOperation::MaskOperation(RelationalOp op, const std::shared_ptr<Tensor> &constant, const DataType &dtype)
: op_(op), constant_(constant), dtype_(dtype) {}

Status MaskOperation::ValidateParams() {


+ 1
- 1
mindspore/ccsrc/minddata/dataset/kernels/ir/data/transforms_ir.h View File

@@ -118,7 +118,7 @@ class FillOperation : public TensorOperation {

class MaskOperation : public TensorOperation {
public:
explicit MaskOperation(RelationalOp op, const std::shared_ptr<Tensor> &constant, DataType dtype);
explicit MaskOperation(RelationalOp op, const std::shared_ptr<Tensor> &constant, const DataType &dtype);

~MaskOperation() = default;



+ 3
- 2
mindspore/ccsrc/minddata/dataset/kernels/ir/vision/random_rotation_ir.cc View File

@@ -35,8 +35,9 @@ constexpr size_t size_two = 2;
constexpr size_t size_three = 3;

// Function to create RandomRotationOperation.
RandomRotationOperation::RandomRotationOperation(std::vector<float> degrees, InterpolationMode resample, bool expand,
std::vector<float> center, std::vector<uint8_t> fill_value)
RandomRotationOperation::RandomRotationOperation(const std::vector<float> &degrees, InterpolationMode resample,
bool expand, const std::vector<float> &center,
const std::vector<uint8_t> &fill_value)
: TensorOperation(true),
degrees_(degrees),
interpolation_mode_(resample),


+ 2
- 2
mindspore/ccsrc/minddata/dataset/kernels/ir/vision/random_rotation_ir.h View File

@@ -37,8 +37,8 @@ constexpr char kRandomRotationOperation[] = "RandomRotation";

class RandomRotationOperation : public TensorOperation {
public:
RandomRotationOperation(std::vector<float> degrees, InterpolationMode resample, bool expand,
std::vector<float> center, std::vector<uint8_t> fill_value);
RandomRotationOperation(const std::vector<float> &degrees, InterpolationMode resample, bool expand,
const std::vector<float> &center, const std::vector<uint8_t> &fill_value);

~RandomRotationOperation();



+ 2
- 2
mindspore/ccsrc/minddata/dataset/kernels/ir/vision/rotate_ir.cc View File

@@ -30,8 +30,8 @@ RotateOperation::RotateOperation(FixRotationAngle angle)
center_({}),
fill_value_({}) {}

RotateOperation::RotateOperation(float degrees, InterpolationMode resample, bool expand, std::vector<float> center,
std::vector<uint8_t> fill_value)
RotateOperation::RotateOperation(float degrees, InterpolationMode resample, bool expand,
const std::vector<float> &center, const std::vector<uint8_t> &fill_value)
: angle_id_(0),
degrees_(degrees),
interpolation_mode_(resample),


+ 4
- 4
mindspore/ccsrc/minddata/dataset/kernels/ir/vision/rotate_ir.h View File

@@ -39,8 +39,8 @@ class RotateOperation : public TensorOperation {
public:
explicit RotateOperation(FixRotationAngle angle);

RotateOperation(float degrees, InterpolationMode resample, bool expand, std::vector<float> center,
std::vector<uint8_t> fill_value);
RotateOperation(float degrees, InterpolationMode resample, bool expand, const std::vector<float> &center,
const std::vector<uint8_t> &fill_value);

~RotateOperation();

@@ -57,13 +57,13 @@ class RotateOperation : public TensorOperation {
void setAngle(uint64_t angle_id);

private:
std::shared_ptr<TensorOp> rotate_op_;
uint64_t angle_id_;
float degrees_;
InterpolationMode interpolation_mode_;
std::vector<float> center_;
bool expand_;
std::vector<float> center_;
std::vector<uint8_t> fill_value_;
std::shared_ptr<TensorOp> rotate_op_;
};

} // namespace vision


Loading…
Cancel
Save