diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/barrier_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/barrier_op.h index 261ff6da6bf77c3defc660aa63b19ea59d9ef787..cdbae0941e2fcc7809b2abfbe914ae08c59a0c9a 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/barrier_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/barrier_op.h @@ -121,6 +121,10 @@ class BarrierOp : public PipelineOp { // @param show_all - if it should print everything void Print(std::ostream &out, bool show_all) const override; + // Op name getter + // @return Name of the current Op + std::string Name() const override { return kBarrierOp; } + // Provide stream operator for displaying it friend std::ostream &operator<<(std::ostream &out, const BarrierOp &bo) { bo.Print(out, false); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc index 844d0543074d1d75cbc59e03b7c85e818192db24..d195647f6585275d67ed18b564490f3ed680fea5 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc @@ -136,7 +136,7 @@ Status BatchOp::operator()() { void BatchOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info ParallelOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h index 825e99a07765d35c47e0607caf6cf78805caefc8..503415704ffe2dbc943cc34e55f523c714ef2fbe 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h @@ -200,7 +200,7 @@ class BatchOp : public ParallelOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "BatchOp"; } + std::string Name() const override { return kBatchOp; } // batch the rows in src table then put it to dest table // @param const std::unique_ptr *src - table that has the rows for batching diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc index 138bb7980bc932a9c7d53f1b4ee67bd8d9a56ec1..971f14c669169569a0cf3e47489953bde12c7972 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc @@ -107,8 +107,6 @@ Status BucketBatchByLengthOp::EoeReceived(int32_t) { return Status::OK(); } -void BucketBatchByLengthOp::Print(std::ostream &out, bool show_all) const { out << "BucketBatchByLengthOp\n"; } - Status BucketBatchByLengthOp::operator()() { TaskManager::FindMe()->Post(); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h index 2c9c92620389759c8ff26f527d975f05a13ffb03..e14a5ff760f576084dca687b6b3d7b2314dc1e6d 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h @@ -109,10 +109,7 @@ class BucketBatchByLengthOp : public PipelineOp { // @return Status - The error code returned Status EoeReceived(int32_t) override; - // A print method typically used for debugging - // @param out - The output stream to write output to - // @param show_all - A bool to control if you want to show all info or just a summary - void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kBucketBatchByLengthOp; } // << Stream output operator overload // @notes This allows you to write the debug print info using stream operators diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h index e53d5276fc915f65cc5beb0977495e3f5b4c4eb0..fc7c7d987fd0c7f4e1e5aa10f80dfb92b4b8d02c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h @@ -157,6 +157,8 @@ class BuildSentencePieceVocabOp : public PipelineOp { Status Reset() override { RETURN_STATUS_UNEXPECTED("Reset shouldn't be called in BuildSentencePieceVocabOp"); } + std::string Name() const override { return kBuildSentencePieceVocabOp; } + // build the input params for sentence api std::unordered_map BuildParams(); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.cc index 28675338422f1efac3a18f86d0ea662d48d80bb1..9b3eaab6f6603efc799d5e4c2b4cdd105e192b96 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.cc @@ -208,7 +208,7 @@ BuildVocabOp::Builder::Builder() // A print method typically used for debugging void BuildVocabOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info ParallelOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.h index 0e8f135529b6c1eb87564d515294c3d6cf86d70d..07650381f84d8717b869abe5e6fae21b322d3437 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.h @@ -135,6 +135,7 @@ class BuildVocabOp : public ParallelOp { /// \param[out] out The output stream to write output to /// \param[in] show_all A bool to control if you want to show all info or just a summary void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kBuildVocabOp; } /// \briefStream output operator overload /// \notes This allows you to write the debug print info using stream operators diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_base_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_base_op.h index 775b20e3123d5ad0ef077f2b997c18af42aa5103..40f3426394e95723892bc5e8304ded473a06264c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_base_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_base_op.h @@ -59,6 +59,9 @@ class CacheBase : public ParallelOp { /// \param show_all A bool to control if you want to show all info or just a summary void Print(std::ostream &out, bool show_all) const override; + /// \brief Gives a name to the class, typically used for debugging + std::string Name() const override { return kCacheBase; } + /// \brief << Stream output operator overload /// \notes This allows you to write the debug print info using stream operators /// \param out reference to the output stream being overloaded diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.h index 37fad046e27e39ab2ef4d08726bca647ecf15e57..adec3d8283ad006ef31863044de0c9b375bb42c4 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.h @@ -100,7 +100,7 @@ class CacheLookupOp : public CacheBase, public Sampler { Status GetNextSample(std::unique_ptr *out_buffer) override; void Print(std::ostream &out, bool show_all) const override; bool AllowCacheMiss() override { return true; } - std::string Name() const override { return "CacheLookupOp"; } + std::string Name() const override { return kCacheLookupOp; } /// \brief Base-class override for NodePass visitor acceptor /// \param[in] p The node to visit diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.cc index 39029918e829fa27a73541826c42b65207d0a8b7..6a7fa6993676e40fecfc77b66176f6bdf17ebfec 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.cc @@ -30,7 +30,7 @@ namespace dataset { CacheMergeOp::~CacheMergeOp() = default; void CacheMergeOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this is summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info ParallelOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.h index 1a818d0d4f7d6d92d3a6992e54b2408431b2db33..a4d92d1221caa00076868c4c2e31e913d841ff37 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.h @@ -140,6 +140,8 @@ class CacheMergeOp : public ParallelOp { std::shared_ptr cache_client, const std::shared_ptr &sampler); ~CacheMergeOp(); void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kCacheMergeOp; } + friend std::ostream &operator<<(std::ostream &out, const CacheMergeOp &mo) { mo.Print(out, false); return out; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.h index 6639e7037cda8c07d8fb1736971202dd0176e946..f6af02fdba7c1c9704b19e7f6048f810a8178188 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.h @@ -140,7 +140,7 @@ class CacheOp : public CacheBase, public RandomAccessOp { /// \brief Base-class override for handling cases if we allow cache miss bool AllowCacheMiss() override { return false; } /// \brief Base-class override for the name of this operator - std::string Name() const override { return "CacheOp"; } + std::string Name() const override { return kCacheOp; } /// \brief A public wrapper for creating the cache through the client /// \param[in] cache_crc The crc that identifies the cache /// \see cache_pass.cc diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.cc index 7acb68350b0a4199a4fca0f5d7e62b101db3be9d..a01a9cc87fd3a19c2475e8f719f4d6b546590367 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.cc @@ -43,7 +43,7 @@ ConcatOp::ConcatOp(int32_t op_connector_size) : PipelineOp(op_connector_size), c // A function that prints info about the Operator void ConcatOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this is summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.h index 5a3bf8a56bd58425dc3727b60cba1762bea52edc..58653b5a01dcd61bebe6c5f3318c74a1ff3e8ef8 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.h @@ -77,7 +77,7 @@ class ConcatOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "ConcatOp"; } + std::string Name() const override { return kConcatOp; } // Private function for computing the assignment of the column name map. // @return - Status diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc index dd53e0527db2fdebd1522764ffff3d76535ec997..69c5ee0315bca0dc4e035ef10441777c10d73eb0 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc @@ -239,6 +239,8 @@ void DatasetOp::Print(std::ostream &out, bool show_all) const { if (sampler_) { sampler_->Print(out, show_all); } + } else { + out << Name() << std::endl; } } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h index b62408618a8a2d922554b04276cbf483b607328b..01eb2f93c338519b85748e986a034077172a0581 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h @@ -28,6 +28,31 @@ namespace mindspore { namespace dataset { +constexpr char kBarrierOp[] = "BarrierOp"; +constexpr char kBatchOp[] = "BatchOp"; +constexpr char kBucketBatchByLengthOp[] = "BucketBatchByLengthOp"; +constexpr char kBuildSentencePieceVocabOp[] = "BuildSentencePieceVocabOp"; +constexpr char kBuildVocabOp[] = "BuildVocabOp"; +constexpr char kCacheBase[] = "CacheBase"; +constexpr char kCacheLookupOp[] = "CacheLookupOp"; +constexpr char kCacheMergeOp[] = "CacheMergeOp"; +constexpr char kCacheOp[] = "CacheOp"; +constexpr char kConcatOp[] = "ConcatOp"; +constexpr char kDatasetOp[] = "DatasetOp"; +constexpr char kDeviceQueueOp[] = "DeviceQueueOp"; +constexpr char kEpochCtrlOp[] = "EpochCtrlOp"; +constexpr char kFilterOp[] = "FilterOp"; +constexpr char kMapOp[] = "MapOp"; +constexpr char kParallelOp[] = "ParallelOp"; +constexpr char kPipelineOp[] = "PipelineOp"; +constexpr char kProjectOp[] = "ProjectOp"; +constexpr char kRenameOp[] = "RenameOp"; +constexpr char kRepeatOp[] = "RepeatOp"; +constexpr char kShuffleOp[] = "ShuffleOp"; +constexpr char kSkipOp[] = "SkipOp"; +constexpr char kTakeOp[] = "TakeOp"; +constexpr char kZipOp[] = "ZipOp"; + // Forward declare class ExecutionTree; @@ -292,7 +317,7 @@ class DatasetOp : public std::enable_shared_from_this { /// Op name getter /// \return Name of the current Op - virtual std::string Name() const { return "DatasetOp"; } + virtual std::string Name() const = 0; /// Execution Tree getter /// \return Pointer to the ExecutionTree the current op belongs to, no ownership diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.cc index d9cda4d4562a48d3ca9ac0b99b1a2ad32ce6806d..1e89a0d0f88cb7808dc2b776997d2c0e69533596 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.cc @@ -307,7 +307,7 @@ Status DeviceQueueOp::SendDataToCPU() { void DeviceQueueOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h index e26c4c3ffc650a9071fde04aaecb96ce03d490df..224d36b85f706144fba0e162b95aca92ca99cf4b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h @@ -146,7 +146,7 @@ class DeviceQueueOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "DeviceQueueOp"; } + std::string Name() const override { return kDeviceQueueOp; } private: // Name: checkExceptions(DataBuffer); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc index de0ab7452f752dc85ed869622d5460e961f0fd86..82885b89c0091a51c2fe1c123ced496b2d0836a3 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc @@ -43,7 +43,7 @@ EpochCtrlOp::~EpochCtrlOp() {} // A print method typically used for debugging void EpochCtrlOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.h index ed8fcb1a344674e460b07a29ace510d6d80302e4..c494208116dd53e7cc51ef551d600ab273eb34cd 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.h @@ -52,6 +52,7 @@ class EpochCtrlOp : public RepeatOp { // @param out - The output stream to write output to // @param show_all - A bool to control if you want to show all info or just a summary void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kEpochCtrlOp; } // This function returns the buffer that is at the top of our output connector. The caller is // typically our parent node, when the parent is asking us to provide the next buffer of data. diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc index f32648a3dff91dc593de9928520d9086bfabea18..39cdb45b203dd07631e8077446e24b69943ae9ae 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc @@ -91,7 +91,7 @@ Status FilterOp::ValidateInColumns(const std::vector *input_columns // A print method typically used for debugging. void FilterOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info ParallelOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.h index 6ab1c2b5991334a8fb58d99b68e4a66b4e7655a2..8cc0cd55ff4a9631ed531b092f028c5080453acf 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.h @@ -129,7 +129,7 @@ class FilterOp : public ParallelOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "FilterOp"; } + std::string Name() const override { return kFilterOp; } private: // predicate_func python callable which returns a boolean value. diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.cc index e5e70dbbdf27ee90004b6cf8100455583675805d..bfd0962ae8326a04a711e03cd5375c43528594a7 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.cc @@ -84,7 +84,7 @@ int32_t MapOp::num_consumers() const { // A print method typically used for debugging void MapOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info ParallelOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.h index 65a72c703c1319f4cda77f649cb98865775ad3e2..7cb580773818412df4c3963e91c16d0b8acf689e 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.h @@ -179,7 +179,7 @@ class MapOp : public ParallelOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "MapOp"; } + std::string Name() const override { return kMapOp; } // List of tensor ops getter/setter // @Return the vector of tensor ops by non-const reference diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.h index b865168d295259a0d38b136298cb1ea3defd41a1..8d7ba6302ae738e6346c7cb59efe3a23d72bc8a6 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.h @@ -17,6 +17,7 @@ #define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_PARALLEL_OP_H_ #include +#include #include #include "minddata/dataset/core/constants.h" #include "minddata/dataset/engine/datasetops/dataset_op.h" @@ -54,6 +55,7 @@ class ParallelOp : public DatasetOp { // @param out - The output stream to write output to // @param show_all - A bool to control if you want to show all info or just a summary void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kParallelOp; } // << Stream output operator overload // @notes This allows you to write the debug print info using stream operators diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/pipeline_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/pipeline_op.h index 9b2ac7d8e796fbeb0eef23e83e6bcd6780ee5bbd..88faad82651456e4a9f9d384cf7de24638a2d9ee 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/pipeline_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/pipeline_op.h @@ -17,6 +17,7 @@ #define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_PIPELINE_OP_H_ #include +#include #include #include "minddata/dataset/engine/datasetops/dataset_op.h" @@ -42,6 +43,7 @@ class PipelineOp : public DatasetOp { // @param out - The output stream to write output to // @param show_all - A bool to control if you want to show all info or just a summary void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kPipelineOp; } // << Stream output operator overload // @notes This allows you to write the debug print info using stream operators diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc index e232a6416484bca1ae116391a308e94f6495117f..9c8013497cc6f8eae83ded86ca623f224cdbb6bf 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc @@ -52,7 +52,7 @@ ProjectOp::ProjectOp(const std::vector &columns_to_project) void ProjectOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h index fd6bf8b85b50beb83efd1f252808dfc79d0613f9..864baab0fa9db5922206a0f125dbfdc11a973fc0 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h @@ -109,7 +109,7 @@ class ProjectOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "ProjectOp"; } + std::string Name() const override { return kProjectOp; } private: std::vector columns_to_project_; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc index d12660e6f900d5f70556f35e76b944c7165d11de..132c826f54200df2047e72c9c316b8b8a8cf9762 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc @@ -142,7 +142,7 @@ Status RenameOp::ComputeColMap() { void RenameOp::Print(std::ostream &out, // In: The output stream to print to bool show_all) const { // In: T/F if it should print everything // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.h index 960509b109e7f1712d068d9ec88d391b4e4ad259..25c9e468960a45638464594d57ae203c8686a98b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.h @@ -118,7 +118,7 @@ class RenameOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "RenameOp"; } + std::string Name() const override { return kRenameOp; } protected: // Rename core functionality diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc index b5319a8a718a7798cca008daf5ca425d2c30ccb0..83cd8b5af85e77b9f64a2fa26614fdcc2f7287e4 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc @@ -54,7 +54,7 @@ RepeatOp::~RepeatOp() {} // A print method typically used for debugging void RepeatOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.h index a055a204770d733077884c4b9a27b72265496428..e763e2bcca5919cd8e13626d85135f0bd711c063 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.h @@ -129,7 +129,7 @@ class RepeatOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "RepeatOp"; } + std::string Name() const override { return kRepeatOp; } // \brief Adds an operator to the repeat ops list of tracked leaf/eoe nodes // \param[in] eoe_op The input leaf/eoe operator to add to the list diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc index 0eb5f29eafa1a5b855d430d14d76e6e01812f918..b1acd79d7c0c50bc2a6c48198408469db6c36f14 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc @@ -101,7 +101,7 @@ Status ShuffleOp::SelfReset() { // A print method typically used for debugging void ShuffleOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.h index b09763907bc6800a3cff2e200aa47bbc7234e060..37ae9230c719b7a75c93e1b908bc3825d3ce5ba1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.h @@ -163,7 +163,7 @@ class ShuffleOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "ShuffleOp"; } + std::string Name() const override { return kShuffleOp; } private: // Private function to add a new row to the shuffle buffer. diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc index 2fe8cbeaa638823b183690a8393564a24d5a0bc8..7c562a03e161101306aea48b31c0db77fedf6003 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc @@ -59,7 +59,7 @@ SkipOp::~SkipOp() {} // A print method typically used for debugging void SkipOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.h index ed20fb3b07dfe10f1c9989958a2a336e7a038442..657da1fe842406b8ce41c42b0096b981137bf00c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.h @@ -82,7 +82,7 @@ class SkipOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "SkipOp"; } + std::string Name() const override { return kSkipOp; } private: int32_t max_skips_; // The number of skips that the user requested diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.cc index d1f07983f7785447ce6cfc0416b77004bc566472..dfd4f254e08959812127eb30ec213c4b3147d27d 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.cc @@ -54,7 +54,7 @@ TakeOp::TakeOp(int32_t count, int32_t op_connector_size) // A print method typically used for debugging void TakeOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.h index 4d98ef3f1eba11e0cf4eba272d92c4bd06208984..d055207520c8a4eedd0230ca7554eaf1e2021f2c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.h @@ -86,7 +86,7 @@ class TakeOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "TakeOp"; } + std::string Name() const override { return kTakeOp; } private: int32_t max_takes_; // The number of takes that the user requested diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc index 0df6375b5940c999622f899dc61db9241d41ebb1..ad513cc4af36bdb76201610d0a9b4f5409862ac1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc @@ -209,7 +209,7 @@ Status ZipOp::drainPipeline() { void ZipOp::Print(std::ostream &out, // In: The output stream to print to bool show_all) const { // In: T/F if it should print everything // Always show the id and name as first line regardless if this is summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.h index 3bbb48aa19604d586cd51e6aeb6d23994371595b..2995b49c23cdbfa903a37f4ae126ba04e193a0d2 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.h @@ -112,7 +112,7 @@ class ZipOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "ZipOp"; } + std::string Name() const override { return kZipOp; } private: // Handles preprocessing of the main loop, used when starting new epoch diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/concatenate_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/concatenate_op.h index e762b548a2553b090d9a2ed0f59391eac5344499..cf2afb30d2c43359f05fd0ca7e7250a22c5b11c0 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/concatenate_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/concatenate_op.h @@ -40,7 +40,6 @@ class ConcatenateOp : public TensorOp { /// Print method to see which tensor Op this is. /// @param std::ostream &out - output stream object. - void Print(std::ostream &out) const override { out << "ConcatenateOp"; } /// Compute method allowing multiple tensors as inputs /// @param TensorRow &input - input tensor rows diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/duplicate_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/duplicate_op.h index 62824c56239e7bca0d16eb81d57829a642cf11e7..bf4aa4bda8fb157f604f26fd8e2378ea5203f7d6 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/duplicate_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/duplicate_op.h @@ -32,8 +32,6 @@ class DuplicateOp : public TensorOp { ~DuplicateOp() override = default; - void Print(std::ostream &out) const override { out << "DuplicateOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; uint32_t NumOutput() override { return 2; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/fill_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/fill_op.h index f2f6d7cfd6e4f52784784d079ca05e2c02b3044b..e2761142df7d1de561a958e314f34672ba50f185 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/fill_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/fill_op.h @@ -31,7 +31,6 @@ class FillOp : public TensorOp { explicit FillOp(std::shared_ptr value) : fill_value_(value) {} ~FillOp() override = default; - void Print(std::ostream &out) const override { out << "FillOp"; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/mask_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/mask_op.h index e6ac8c396454ad4eb067660d14daccb947dbb514..762cf1de409ab41945c7109835c58f1f3e98b4c6 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/mask_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/mask_op.h @@ -37,8 +37,6 @@ class MaskOp : public TensorOp { ~MaskOp() override = default; - void Print(std::ostream &out) const override { out << "MaskOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputType(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/one_hot_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/one_hot_op.h index 493f943ff84c646247756cac2bc2ca8e32aa00fa..629a7e3082656a4590c7c425729dab354407c18c 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/one_hot_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/one_hot_op.h @@ -31,8 +31,6 @@ class OneHotOp : public TensorOp { ~OneHotOp() override = default; - void Print(std::ostream &out) const override { out << "OneHotOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputShape(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/pad_end_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/pad_end_op.h index 5a0639bf70faee790ce35fa5e9ab38aa872a353e..019124382a7f1fd78ab81ff52ad2d0ae9ff67a53 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/pad_end_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/pad_end_op.h @@ -32,8 +32,6 @@ class PadEndOp : public TensorOp { ~PadEndOp() override = default; - void Print(std::ostream &out) const override { out << "PadEndOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputShape(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/slice_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/slice_op.h index 6c77846c01091261cc3d525b5ce53bc27cd53733..39042cf6d41067b840e2f6e76df57e46e314b1b1 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/slice_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/slice_op.h @@ -67,8 +67,6 @@ class SliceOp : public TensorOp { ~SliceOp() override = default; - void Print(std::ostream &out) const override { out << "SliceOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kSliceOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/to_float16_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/to_float16_op.h index 91f660ca9cf6f485b5551b66d44500db50a9e5ce..6d0b2f6f30a05f71003436e94e07ae9ff6c50027 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/to_float16_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/to_float16_op.h @@ -39,8 +39,6 @@ class ToFloat16Op : public TensorOp { // @return Status - The error code return Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; - void Print(std::ostream &out) const override { out << "ToFloat16Op"; } - Status OutputType(const std::vector &inputs, std::vector &outputs) override; std::string Name() const override { return kToFloat16Op; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/type_cast_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/type_cast_op.h index 744c99bd0d99eda835c5f410f78f03a7f12fc235..64a84713da73a55acd52ec5c23b621a247400a81 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/type_cast_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/type_cast_op.h @@ -39,7 +39,6 @@ class TypeCastOp : public TensorOp { Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; - void Print(std::ostream &out) const override { out << "TypeCastOp"; } Status OutputType(const std::vector &inputs, std::vector &outputs) override; std::string Name() const override { return kTypeCastOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/auto_contrast_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/auto_contrast_op.h index 0bbed64173a084959dd142f199394dc5a78e2d7b..6d8c847b679259f4c6f14be9d5512eedbbc1cebc 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/auto_contrast_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/auto_contrast_op.h @@ -45,8 +45,6 @@ class AutoContrastOp : public TensorOp { return out; } - void Print(std::ostream &out) const override { out << Name(); } - std::string Name() const override { return kAutoContrastOp; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/bounding_box_augment_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/bounding_box_augment_op.h index f2eee20f3e5ba0996dfcb36a7047c48f2545cbfa..c992c9196e68ad3298199fa9008af6122a50f9cf 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/bounding_box_augment_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/bounding_box_augment_op.h @@ -47,8 +47,6 @@ class BoundingBoxAugmentOp : public TensorOp { return out; } - void Print(std::ostream &out) const override { out << "BoundingBoxAugmentOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kBoundingBoxAugmentOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/decode_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/decode_op.h index 62a0437e5ce2f7a2d2d7648a7ba46d30c218ca99..b5bfe5a0146cfa478692ffa9176c2f3dda11b40b 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/decode_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/decode_op.h @@ -37,7 +37,6 @@ class DecodeOp : public TensorOp { Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; - void Print(std::ostream &out) const override { out << "DecodeOp"; } Status OutputShape(const std::vector &inputs, std::vector &outputs) override; Status OutputType(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/equalize_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/equalize_op.h index 9fd030f5852d396ca344a373f182893851ad022d..d7bc46b4802155b311d2b83c6b062c5ead2d2f07 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/equalize_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/equalize_op.h @@ -32,9 +32,6 @@ class EqualizeOp : public TensorOp { EqualizeOp() {} ~EqualizeOp() = default; - // Description: A function that prints info about the node - void Print(std::ostream &out) const override { out << Name(); } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kEqualizeOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/hwc_to_chw_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/hwc_to_chw_op.h index c071b9c47600d1fbf745f4388b18a73b39d20175..c2eb2e8759330a5cf9214bb795f2f35572bc77ae 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/hwc_to_chw_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/hwc_to_chw_op.h @@ -28,8 +28,6 @@ namespace mindspore { namespace dataset { class HwcToChwOp : public TensorOp { public: - void Print(std::ostream &out) const override { out << "HwcToChw"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputShape(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/invert_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/invert_op.h index 7db01f7d3f77d5aa2b00885feb792eaea816d448..3a9ee464c9b695f9fd4907ebc4975a33fbfbc6ff 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/invert_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/invert_op.h @@ -31,9 +31,6 @@ class InvertOp : public TensorOp { InvertOp() {} ~InvertOp() = default; - // Description: A function that prints info about the node - void Print(std::ostream &out) const override { out << Name(); } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kInvertOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/pad_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/pad_op.h index a89f8be73828418da9ee1abeef5bbf2350e34df5..7f2e313c3825d788a056d5c26811df7f81e12690 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/pad_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/pad_op.h @@ -49,8 +49,6 @@ class PadOp : public TensorOp { ~PadOp() override = default; - void Print(std::ostream &out) const override { out << "PadOp: "; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputShape(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_adjust_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_adjust_op.h index 98201c4ace11dac80c9054ad4751f6d2b1d41fa2..5555963ac59160af107c1ccd39f255526120b16e 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_adjust_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_adjust_op.h @@ -47,10 +47,6 @@ class RandomColorAdjustOp : public TensorOp { ~RandomColorAdjustOp() override = default; - // Print function for RandomJitter. - // @param out output stream to print to. - void Print(std::ostream &out) const override { out << "RandomColorAdjustOp: "; } - // Overrides the base class compute function. // Calls multiple transform functions in ImageUtils, this function takes an input tensor. // and transforms its data using openCV, the output memory is manipulated to contain the result. diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_decode_resize_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_decode_resize_op.h index bb280cc1996c0ba9d6a5f6697fe43efab07c3341..161bdaf42f42964310b50699c84415021bdc1293 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_decode_resize_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_decode_resize_op.h @@ -40,8 +40,7 @@ class RandomCropDecodeResizeOp : public RandomCropAndResizeOp { ~RandomCropDecodeResizeOp() override = default; void Print(std::ostream &out) const override { - out << "RandomCropDecodeResize: " << RandomCropAndResizeOp::target_height_ << " " - << RandomCropAndResizeOp::target_width_; + out << Name() << ": " << RandomCropAndResizeOp::target_height_ << " " << RandomCropAndResizeOp::target_width_; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_op.h index 8e437580d400b77af0be01597821e0e1f6a31ca2..3dfb3f713d163fc178b3b2610280659dc669f150 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_op.h @@ -52,7 +52,7 @@ class RandomCropOp : public TensorOp { ~RandomCropOp() override = default; - void Print(std::ostream &out) const override { out << "RandomCropOp: " << crop_height_ << " " << crop_width_; } + void Print(std::ostream &out) const override { out << Name() << ": " << crop_height_ << " " << crop_width_; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_with_bbox_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_with_bbox_op.h index 089fe76f0f79b16cc59690889f3081c0f9038d40..479f08795406456ff921f2e5cbf765f9e76ca42d 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_with_bbox_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_with_bbox_op.h @@ -38,7 +38,7 @@ class RandomCropWithBBoxOp : public RandomCropOp { ~RandomCropWithBBoxOp() override = default; void Print(std::ostream &out) const override { - out << "RandomCropWithBBoxOp: " << RandomCropOp::crop_height_ << " " << RandomCropOp::crop_width_; + out << Name() << ": " << RandomCropOp::crop_height_ << " " << RandomCropOp::crop_width_; } Status Compute(const TensorRow &input, TensorRow *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_op.h index c5610cfc506c0964faf0997283c8fbcab4b2c4fb..53c11df1a6e73f3596f3e188ede9da1574f3258a 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_op.h @@ -44,8 +44,6 @@ class RandomHorizontalFlipOp : public TensorOp { return out; } - void Print(std::ostream &out) const override { out << "RandomHorizontalFlipOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kRandomHorizontalFlipOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h index 0cb8815c2eac82dd86e855835a22a5d125b131f9..f8e1e847f663f64939baaaebf5e57a0d8ab7ef0f 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h @@ -45,8 +45,6 @@ class RandomHorizontalFlipWithBBoxOp : public TensorOp { return out; } - void Print(std::ostream &out) const override { out << "RandomHorizontalFlipWithBBoxOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kRandomHorizontalFlipWithBBoxOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_op.h index 9b4a1cf126b6ab94756130a06c45a5d31b119094..77dee5b4d9c88d3f892df57e65604b5c0c85fdac 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_op.h @@ -40,9 +40,7 @@ class RandomResizeOp : public ResizeOp { ~RandomResizeOp() = default; // Description: A function that prints info about the node - void Print(std::ostream &out) const override { - out << "RandomResizeOp: " << ResizeOp::size1_ << " " << ResizeOp::size2_; - } + void Print(std::ostream &out) const override { out << Name() << ": " << ResizeOp::size1_ << " " << ResizeOp::size2_; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_with_bbox_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_with_bbox_op.h index d5e70d08e21b438fc96bf112b664837638d9b7b4..dbca032520eb0bb67f9ecd1c2303ae263143d413 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_with_bbox_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_with_bbox_op.h @@ -42,7 +42,7 @@ class RandomResizeWithBBoxOp : public ResizeWithBBoxOp { // Description: A function that prints info about the node void Print(std::ostream &out) const override { - out << "RandomResizeWithBBoxOp: " << ResizeWithBBoxOp::size1_ << " " << ResizeWithBBoxOp::size2_; + out << Name() << ": " << ResizeWithBBoxOp::size1_ << " " << ResizeWithBBoxOp::size2_; } Status Compute(const TensorRow &input, TensorRow *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_rotation_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_rotation_op.h index 17777a60d86da9f52e5d274a27184de24f6de21f..bdd5cda97a6154decb71782674f0d137b9800d84 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_rotation_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_rotation_op.h @@ -58,10 +58,6 @@ class RandomRotationOp : public TensorOp { ~RandomRotationOp() override = default; - // Print function for RandomRotation - // @param out output stream to print to - void Print(std::ostream &out) const override { out << "RandomRotationOp: "; } - // Overrides the base class compute function // Calls the rotate function in ImageUtils, this function takes an input tensor // and transforms its data using openCV, the output memory is manipulated to contain the result diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_op.h index 6b328d58821fde1a6fdeafb807532e3acbca2417..1724d7a57d778c68c5faa6f064cb4018a8802cfb 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_op.h @@ -38,8 +38,6 @@ class RandomVerticalFlipOp : public TensorOp { ~RandomVerticalFlipOp() override = default; - void Print(std::ostream &out) const override { out << "RandomVerticalFlipOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kRandomVerticalFlipOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h index 68cbf81c8e8d5fd22e0fc05928b6771673d6795d..d3e7871aec6b007a3cc8ebf43bd93e32373c6b50 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h @@ -39,8 +39,6 @@ class RandomVerticalFlipWithBBoxOp : public TensorOp { ~RandomVerticalFlipWithBBoxOp() override = default; - void Print(std::ostream &out) const override { out << "RandomVerticalFlipWithBBoxOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kRandomVerticalFlipWithBBoxOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/rescale_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/rescale_op.h index 8f8943ad63de43bf605fbc9411d85e165d45cbb4..1a6f597ad55ad9f26c02b9b16caa858954423af3 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/rescale_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/rescale_op.h @@ -33,7 +33,7 @@ class RescaleOp : public TensorOp { ~RescaleOp() override = default; void Print(std::ostream &out) const override { - out << "RescaleOp: shift: " << shift_ << ", Rescale: " << rescale_ << std::endl; + out << Name() << ": shift: " << shift_ << ", Rescale: " << rescale_ << std::endl; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.cc index 48a8fbbc5332245680b6334cce58fb4a3009f541..db10f5f10c3b68b6c16b9de401805b26dcf78582 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.cc @@ -22,6 +22,5 @@ namespace mindspore { namespace dataset { const int32_t ResizeBilinearOp::kDefWidth = 0; -void ResizeBilinearOp::Print(std::ostream &out) const { out << "ResizeBilinearOp: "; } } // namespace dataset } // namespace mindspore diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.h index 99222622b0353c2c22991547459891270a8a1ff6..ab5ecd292a83ddc5c8858996321f7b0fcf0f1746 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.h @@ -48,10 +48,6 @@ class ResizeBilinearOp : public ResizeOp { // Description: Destructor ~ResizeBilinearOp() = default; - // Name: Print() - // Description: A function that prints info about the node - void Print(std::ostream &out) const override; - std::string Name() const override { return kResizeBilinearOp; } }; } // namespace dataset diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_op.h index 9693e95106b4d86c44bc5d2e738c612b62d1a17f..149cab6e8522c00997156fd3abfca451bfcf63c1 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_op.h @@ -50,7 +50,7 @@ class ResizeOp : public TensorOp { ~ResizeOp() override = default; - void Print(std::ostream &out) const override { out << "ResizeOp: " << size1_ << " " << size2_; } + void Print(std::ostream &out) const override { out << Name() << ": " << size1_ << " " << size2_; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputShape(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_with_bbox_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_with_bbox_op.h index c975d956a5694db2c9001522da6153ad48d34d31..18781da1a58c7da198f52da3d1bd5b8246bacc41 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_with_bbox_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_with_bbox_op.h @@ -34,7 +34,7 @@ class ResizeWithBBoxOp : public ResizeOp { ~ResizeWithBBoxOp() override = default; - void Print(std::ostream &out) const override { out << "ResizeWithBBoxOp: " << size1_ << " " << size2_; } + void Print(std::ostream &out) const override { out << Name() << ": " << size1_ << " " << size2_; } Status Compute(const TensorRow &input, TensorRow *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/uniform_aug_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/uniform_aug_op.h index af5158bc7f250524585a75316546d5bafd9276ab..ec7080d1deb4c3521c199d682aea0bc5fe72b714 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/uniform_aug_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/uniform_aug_op.h @@ -40,7 +40,7 @@ class UniformAugOp : public TensorOp { // Destructor ~UniformAugOp() override = default; - void Print(std::ostream &out) const override { out << "UniformAugOp:: number of ops " << num_ops_; } + void Print(std::ostream &out) const override { out << Name() << ":: number of ops " << num_ops_; } // Overrides the base class compute function // @return Status - The error code return diff --git a/mindspore/ccsrc/minddata/dataset/kernels/no_op.h b/mindspore/ccsrc/minddata/dataset/kernels/no_op.h index d6058d63d6f3bef2370b5cc37ea19c947aeeb937..18761cde25dd2b127eb0925807d6a8e204f3fb46 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/no_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/no_op.h @@ -31,8 +31,6 @@ class NoOp : public TensorOp { return Status::OK(); } - void Print(std::ostream &out) const override { out << "NoOp"; }; - std::string Name() const override { return kNoOp; } }; } // namespace dataset diff --git a/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.cc b/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.cc index b625e3b532cc875e2df3c6ccfc7ba8bc639611fa..e394284679f48c5ec9f43a2c8974d2c52eedd087 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.cc @@ -48,8 +48,6 @@ Status TensorOp::Compute(const TensorRow &input, TensorRow *output) { "Is this TensorOp oneToOne? If no, please implement this Compute() in the derived class."); } -void TensorOp::Print(std::ostream &out) const { out << "TensorOp" << std::endl; } - Status TensorOp::OutputShape(const std::vector &inputs, std::vector &outputs) { if (inputs.size() != NumInput()) return Status(StatusCode::kUnexpectedError, diff --git a/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.h b/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.h index 1db0e7ab41dd84d4de9579e47f1495a638644f78..9c16f541a96f58265af8f63edb7c799c05c3ed68 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.h @@ -86,6 +86,9 @@ namespace mindspore { namespace dataset { +// base class +constexpr char kTensorOp[] = "TensorOp"; + // image constexpr char kAutoContrastOp[] = "AutoContrastOp"; constexpr char kBoundingBoxAugmentOp[] = "BoundingBoxAugmentOp"; @@ -140,7 +143,7 @@ constexpr char kRandomSelectSubpolicyOp[] = "RandomSelectSubpolicyOp"; constexpr char kSentencepieceTokenizerOp[] = "SentencepieceTokenizerOp"; // data -constexpr char kConcatenateOp[] = "kConcatenateOp"; +constexpr char kConcatenateOp[] = "ConcatenateOp"; constexpr char kDuplicateOp[] = "DuplicateOp"; constexpr char kFillOp[] = "FillOp"; constexpr char kMaskOp[] = "MaskOp"; @@ -163,7 +166,7 @@ class TensorOp { // A function that prints info about the tensor operation // @param out - virtual void Print(std::ostream &out) const; + virtual void Print(std::ostream &out) const { out << Name() << std::endl; } // Provide stream operator for displaying it // @param output stream diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/basic_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/basic_tokenizer_op.h index b8234a5af9a4f67195c8e3cc5669d41188f0a526..39b4ec521d9af5dcd78fbba69f6d95a14c761013 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/basic_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/basic_tokenizer_op.h @@ -45,8 +45,6 @@ class BasicTokenizerOp : public TensorOp { ~BasicTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "BasicTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; protected: diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/bert_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/bert_tokenizer_op.h index 429e1af02e61faf7e04f5db4bbdf7e52f20f63b3..5af84da5d9017cfc3c91a63673b0cd14e3dc2a7c 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/bert_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/bert_tokenizer_op.h @@ -42,8 +42,6 @@ class BertTokenizerOp : public TensorOp { ~BertTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "BertTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kBertTokenizerOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/case_fold_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/case_fold_op.h index 417f6177778ab0da06cb0f3fa034c9807065a6c0..9b2f4bef1df4af5fe9633a48e4f19d14271d8c49 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/case_fold_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/case_fold_op.h @@ -31,8 +31,6 @@ class CaseFoldOp : public TensorOp { ~CaseFoldOp() override = default; - void Print(std::ostream &out) const override { out << "CaseFoldOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kCaseFoldOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/jieba_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/jieba_tokenizer_op.h index 2cbd56bb406eb0fa4d62d78959581b52b7c82180..a319ccd015ba1e3dda585b74f771ff2d3a666a8d 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/jieba_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/jieba_tokenizer_op.h @@ -46,8 +46,7 @@ class JiebaTokenizerOp : public TensorOp { ~JiebaTokenizerOp() override = default; void Print(std::ostream &out) const override { - out << "JiebaTokenizerOp: " << jieba_mode_ << "hmm_model_path_ " << hmm_model_path_ << "mp_dict_path_" - << mp_dict_path_; + out << Name() << ": " << jieba_mode_ << "hmm_model_path_ " << hmm_model_path_ << "mp_dict_path_" << mp_dict_path_; } Status Compute(const TensorRow &input, TensorRow *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/normalize_utf8_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/normalize_utf8_op.h index 69ceee4b354d9b009f2c30dd1099c7fcdfe6940b..66b630adb111e298a5d3f25d69103c8ab6a4e74a 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/normalize_utf8_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/normalize_utf8_op.h @@ -39,8 +39,6 @@ class NormalizeUTF8Op : public TensorOp { ~NormalizeUTF8Op() override = default; - void Print(std::ostream &out) const override { out << "NormalizeUTF8Op"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kNormalizeUTF8Op; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/regex_replace_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/regex_replace_op.h index 601fb8a40279243ac29609b9140e01cfd1f2bee0..ae9723da09ba0d6ecad8f0a3693bc75643987cca 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/regex_replace_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/regex_replace_op.h @@ -38,8 +38,6 @@ class RegexReplaceOp : public TensorOp { ~RegexReplaceOp() override = default; - void Print(std::ostream &out) const override { out << "RegexReplaceOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kRegexReplaceOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/regex_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/regex_tokenizer_op.h index 1ce7cef3dbfc69df06d310cfb70c7a2c3ac3a54b..eabed89480285e7016a4a9fee9a3b89d7da8ea9d 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/regex_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/regex_tokenizer_op.h @@ -43,8 +43,6 @@ class RegexTokenizerOp : public TensorOp { ~RegexTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "RegexTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; protected: diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.h index 130842cb774f2390e171b07465b4dbb157b31a53..8106726e61da226afe036119a4741486ec17f1ab 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.h @@ -45,7 +45,7 @@ class SentencePieceTokenizerOp : public TensorOp { Status GetModelRealPath(const std::string &model_path, const std::string &filename); void Print(std::ostream &out) const override { - out << "SentencePieceTokenizerOp out_type = " << out_type_ << " load_type = " << load_type_; + out << Name() << " out_type = " << out_type_ << " load_type = " << load_type_; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/sliding_window_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/sliding_window_op.h index d944d4eb5eaf6a67fd135254b073c053cea1077b..5725e94a7b5161dc1e1e642af8018ea27bd059bc 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/sliding_window_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/sliding_window_op.h @@ -52,10 +52,6 @@ class SlidingWindowOp : public TensorOp { /// \return Status return code Status OutputShape(const std::vector &inputs, std::vector &outputs) override; - /// \brief Print args for debugging. - /// \param[in] out - std::ostream &out. - void Print(std::ostream &out) const override { out << "SliceWindowOp"; } - /// \brief Print name of op. std::string Name() const override { return kSlidingWindowOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/truncate_sequence_pair_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/truncate_sequence_pair_op.h index e8a9d8631579c9da23403192c251b98b9191b0fb..dbfcd6b61a86906a8fe9ac3eb4c3e9ac0df6f53e 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/truncate_sequence_pair_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/truncate_sequence_pair_op.h @@ -36,8 +36,6 @@ class TruncateSequencePairOp : public TensorOp { ~TruncateSequencePairOp() override = default; - void Print(std::ostream &out) const override { out << "TruncateSequencePairOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kTruncateSequencePairOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_char_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_char_tokenizer_op.h index acfec8e5c861196ce5b470d95b60c523f109e7bc..8a0bc01391622378ca1380f44586628b2f0d146d 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_char_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_char_tokenizer_op.h @@ -33,8 +33,6 @@ class UnicodeCharTokenizerOp : public TensorOp { ~UnicodeCharTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "UnicodeCharTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kUnicodeCharTokenizerOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_script_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_script_tokenizer_op.h index cb093c69fbbfecf739530c0bbbee509ea7847c34..2fe562968206c9a26dd02ad90bf10df8e2728466 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_script_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_script_tokenizer_op.h @@ -36,8 +36,6 @@ class UnicodeScriptTokenizerOp : public TensorOp { ~UnicodeScriptTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "UnicodeScriptTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kUnicodeScriptTokenizerOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/whitespace_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/whitespace_tokenizer_op.h index 652257d33b550e7c3292df8aa3420e63cbbb842d..adbc6f62441216fbb0f1e8ae4d7c8a498f8cad10 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/whitespace_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/whitespace_tokenizer_op.h @@ -33,8 +33,6 @@ class WhitespaceTokenizerOp : public TensorOp { ~WhitespaceTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "WhitespaceTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kWhitespaceTokenizerOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/wordpiece_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/wordpiece_tokenizer_op.h index f7c57842ce6ba00082d35ba8dd11a4c8afb44fc4..d636ab8e0f42497db96c15dd6550e5369813592f 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/wordpiece_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/wordpiece_tokenizer_op.h @@ -44,8 +44,6 @@ class WordpieceTokenizerOp : public TensorOp { ~WordpieceTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "WordpieceTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; protected: diff --git a/tests/ut/cpp/dataset/batch_op_test.cc b/tests/ut/cpp/dataset/batch_op_test.cc index 3e1f3c0b32005ccb27c102a07e53cde7fd1fc928..11d3f3e05fa9993914a22c12a1b74dad580f3bb9 100644 --- a/tests/ut/cpp/dataset/batch_op_test.cc +++ b/tests/ut/cpp/dataset/batch_op_test.cc @@ -78,7 +78,10 @@ std::shared_ptr Build(std::vector &op = Batch(12); + EXPECT_EQ(op->Name(), "BatchOp"); + + auto tree = Build({TFReader(schema_file), op}); tree->Prepare(); Status rc = tree->Launch(); if (rc.IsError()) { diff --git a/tests/ut/cpp/dataset/concatenate_op_test.cc b/tests/ut/cpp/dataset/concatenate_op_test.cc index dc2fc69266c2259229f46fcc994cea1f19af9c4d..fa8a20fffd105a8bb2825ffa44495e23939874bd 100644 --- a/tests/ut/cpp/dataset/concatenate_op_test.cc +++ b/tests/ut/cpp/dataset/concatenate_op_test.cc @@ -54,13 +54,5 @@ TEST_F(MindDataTestConcatenateOp, TestOp) { ASSERT_TRUE(output->type() == expected->type()); MS_LOG(DEBUG) << *output << std::endl; MS_LOG(DEBUG) << *expected << std::endl; - ASSERT_TRUE(*output == *expected); - - // std::vector inputs = {TensorShape({3})}; - // std::vector outputs = {}; - // s = op->OutputShape(inputs, outputs); - // EXPECT_TRUE(s.IsOk()); - // ASSERT_TRUE(outputs[0] == TensorShape{6}); - // MS_LOG(INFO) << "MindDataTestConcatenateOp-TestOp end."; }