From: @cathwong Reviewed-by: @nsyca Signed-off-by: @nsycatags/v1.2.0-rc1
| @@ -498,13 +498,13 @@ Status BatchOp::UnpackPadInfo(const PadInfo &pad_info, | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status BatchOp::Accept(NodePass *p, bool *modified) { | |||
| Status BatchOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<BatchOp>(), modified); | |||
| } | |||
| // Visitor pre-accept method for NodePass | |||
| Status BatchOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status BatchOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->PreRunOnNode(shared_from_base<BatchOp>(), modified); | |||
| } | |||
| @@ -197,13 +197,13 @@ class BatchOp : public ParallelOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Base-class override for NodePass visitor acceptor. | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -161,7 +161,7 @@ void BuildSentencePieceVocabOp::Next(std::string *sentence) { | |||
| } | |||
| // Pre-Visitor accept method for NodePass | |||
| Status BuildSentencePieceVocabOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status BuildSentencePieceVocabOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call the pre-visitation | |||
| return p->PreRunOnNode(shared_from_base<BuildSentencePieceVocabOp>(), modified); | |||
| } | |||
| @@ -169,7 +169,7 @@ class BuildSentencePieceVocabOp : public PipelineOp { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| private: | |||
| bool read_done_; | |||
| @@ -231,7 +231,7 @@ void BuildVocabOp::Print(std::ostream &out, bool show_all) const { | |||
| } | |||
| // Pre-Visitor accept method for NodePass | |||
| Status BuildVocabOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status BuildVocabOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call the pre-visitation | |||
| return p->PreRunOnNode(shared_from_base<BuildVocabOp>(), modified); | |||
| } | |||
| @@ -172,7 +172,7 @@ class BuildVocabOp : public ParallelOp { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| private: | |||
| const int32_t interval_; | |||
| @@ -135,7 +135,7 @@ Status CacheLookupOp::ComputeColMap() { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status CacheLookupOp::Accept(NodePass *p, bool *modified) { | |||
| Status CacheLookupOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<CacheLookupOp>(), modified); | |||
| } | |||
| @@ -107,7 +107,7 @@ class CacheLookupOp : public CacheBase, public SamplerRT { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| protected: | |||
| Status ComputeColMap() override; | |||
| @@ -263,13 +263,13 @@ Status CacheMergeOp::Builder::Build(std::shared_ptr<CacheMergeOp> *ptr) { | |||
| } | |||
| // Pre-Visitor accept method for NodePass | |||
| Status CacheMergeOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status CacheMergeOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call the pre-visitation | |||
| return p->PreRunOnNode(shared_from_base<CacheMergeOp>(), modified); | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status CacheMergeOp::Accept(NodePass *p, bool *modified) { | |||
| Status CacheMergeOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<CacheMergeOp>(), modified); | |||
| } | |||
| @@ -174,13 +174,13 @@ class CacheMergeOp : public ParallelOp { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| /// \brief Base-class override for NodePass visitor acceptor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| /// \brief Base-class override for eoe handling | |||
| /// \param worker_id | |||
| @@ -226,13 +226,13 @@ Status CacheOp::EofReceived(int32_t worker_id) { | |||
| } | |||
| // Pre-Visitor accept method for NodePass | |||
| Status CacheOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status CacheOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call the pre-visitation | |||
| return p->PreRunOnNode(shared_from_base<CacheOp>(), modified); | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status CacheOp::Accept(NodePass *p, bool *modified) { | |||
| Status CacheOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<CacheOp>(), modified); | |||
| } | |||
| @@ -125,12 +125,12 @@ class CacheOp : public CacheBase, public RandomAccessOp { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| /// \brief Base-class override for NodePass visitor acceptor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| /// \brief Base-class override for handling cases when an eof is received. | |||
| /// \param worker_id - The worker id | |||
| /// \return Status The status code returned | |||
| @@ -191,7 +191,7 @@ Status ConcatOp::ComputeColMap() { | |||
| } | |||
| // Visitor pre-accept method for NodePass | |||
| Status ConcatOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status ConcatOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->PreRunOnNode(shared_from_base<ConcatOp>(), modified); | |||
| } | |||
| @@ -109,7 +109,7 @@ class ConcatOp : public PipelineOp { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| /// \brief Gets the number of classes | |||
| /// \param[out] num_classes the number of classes | |||
| @@ -402,13 +402,13 @@ Status DatasetOp::ComputeColMap() { | |||
| return Status::OK(); | |||
| } | |||
| Status DatasetOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status DatasetOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // DatasetOp is the base class of visitor target pre-visit. | |||
| // This method will only be called if its derived class does not implement one. | |||
| return p->PreRunOnNode(shared_from_this(), modified); | |||
| } | |||
| Status DatasetOp::Accept(NodePass *p, bool *modified) { | |||
| Status DatasetOp::Accept(NodePass *p, bool *const modified) { | |||
| // DatasetOp is the base class of visitor target. | |||
| // This method will only be called if its derived class does not implement one. | |||
| return p->RunOnNode(shared_from_this(), modified); | |||
| @@ -326,14 +326,14 @@ class DatasetOp : public std::enable_shared_from_this<DatasetOp> { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| virtual Status PreAccept(NodePass *p, bool *modified); | |||
| virtual Status PreAccept(NodePass *p, bool *const modified); | |||
| /// \brief Base method for NodePass visit. Subclass needs to override this if it requires special node visit access. | |||
| /// Check "dataset/engine/opt/pass.h" for more details. | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| virtual Status Accept(NodePass *p, bool *modified); | |||
| virtual Status Accept(NodePass *p, bool *const modified); | |||
| /// Op name getter | |||
| /// \return Name of the current Op | |||
| @@ -503,7 +503,7 @@ void DeviceQueueOp::Print(std::ostream &out, bool show_all) const { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status DeviceQueueOp::Accept(NodePass *p, bool *modified) { | |||
| Status DeviceQueueOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<DeviceQueueOp>(), modified); | |||
| } | |||
| @@ -171,7 +171,7 @@ class DeviceQueueOp : public PipelineOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -105,13 +105,13 @@ Status EpochCtrlOp::EoeReceived(int32_t worker_id) { | |||
| } | |||
| // Pre-Visitor accept method for NodePass | |||
| Status EpochCtrlOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status EpochCtrlOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call the pre-visitation | |||
| return p->PreRunOnNode(shared_from_base<EpochCtrlOp>(), modified); | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status EpochCtrlOp::Accept(NodePass *p, bool *modified) { | |||
| Status EpochCtrlOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call the pre-visitation | |||
| return p->RunOnNode(shared_from_base<EpochCtrlOp>(), modified); | |||
| } | |||
| @@ -69,13 +69,13 @@ class EpochCtrlOp : public RepeatOp { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| /// \brief Base-class override for NodePass visitor acceptor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| int64_t GetTreeRepeatCount() override; | |||
| }; | |||
| @@ -248,13 +248,13 @@ Status FilterOp::InvokePredicateFunc(const TensorRow &input, bool *out_predicate | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status FilterOp::Accept(NodePass *p, bool *modified) { | |||
| Status FilterOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<FilterOp>(), modified); | |||
| } | |||
| // Visitor pre-accept method for NodePass | |||
| Status FilterOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status FilterOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->PreRunOnNode(shared_from_base<FilterOp>(), modified); | |||
| } | |||
| @@ -125,13 +125,13 @@ class FilterOp : public ParallelOp { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| // Base-class override for NodePass visitor acceptor. | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -438,13 +438,13 @@ void MapOp::CreateFinalColMap(std::unordered_map<std::string, int32_t> *col_name | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status MapOp::Accept(NodePass *p, bool *modified) { | |||
| Status MapOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<MapOp>(), modified); | |||
| } | |||
| // Visitor pre-accept method for NodePass | |||
| Status MapOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status MapOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->PreRunOnNode(shared_from_base<MapOp>(), modified); | |||
| } | |||
| @@ -181,13 +181,13 @@ class MapOp : public ParallelOp { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| /// \brief Base-class override for NodePass visitor acceptor. | |||
| /// \param[in] p Pointer to the NodePass to be accepted. | |||
| /// \param[out] modified Whether this node visit modified the pipeline. | |||
| /// \return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -130,7 +130,7 @@ Status ProjectOp::EoeReceived(int32_t worker_id) { | |||
| Status ProjectOp::EofReceived(int32_t worker_id) { return Status::OK(); } | |||
| // Visitor accept method for NodePass | |||
| Status ProjectOp::Accept(NodePass *p, bool *modified) { | |||
| Status ProjectOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<ProjectOp>(), modified); | |||
| } | |||
| @@ -105,7 +105,7 @@ class ProjectOp : public PipelineOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -172,7 +172,7 @@ Status RenameOp::EoeReceived(int32_t) { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status RenameOp::Accept(NodePass *p, bool *modified) { | |||
| Status RenameOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<RenameOp>(), modified); | |||
| } | |||
| @@ -114,7 +114,7 @@ class RenameOp : public PipelineOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -176,13 +176,13 @@ int32_t RepeatOp::num_producers() const { | |||
| } | |||
| // Pre-Visitor accept method for NodePass | |||
| Status RepeatOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status RepeatOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call the pre-visitation | |||
| return p->PreRunOnNode(shared_from_base<RepeatOp>(), modified); | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status RepeatOp::Accept(NodePass *p, bool *modified) { | |||
| Status RepeatOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<RepeatOp>(), modified); | |||
| } | |||
| @@ -113,13 +113,13 @@ class RepeatOp : public PipelineOp { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| /// \brief Base-class override for NodePass visitor acceptor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -293,7 +293,7 @@ Status ShuffleOp::EoeReceived(int32_t worker_id) { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status ShuffleOp::Accept(NodePass *p, bool *modified) { | |||
| Status ShuffleOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<ShuffleOp>(), modified); | |||
| } | |||
| @@ -159,7 +159,7 @@ class ShuffleOp : public PipelineOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -125,13 +125,13 @@ Status SkipOp::EofReceived(int32_t worker_id) { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status SkipOp::Accept(NodePass *p, bool *modified) { | |||
| Status SkipOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<SkipOp>(), modified); | |||
| } | |||
| // Visitor pre-accept method for NodePass | |||
| Status SkipOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status SkipOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->PreRunOnNode(shared_from_base<SkipOp>(), modified); | |||
| } | |||
| @@ -78,13 +78,13 @@ class SkipOp : public PipelineOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| /// \brief Base-class override for NodePass pre-visit acceptor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -592,7 +592,7 @@ Status AlbumOp::LaunchThreadsAndInitOp() { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status AlbumOp::Accept(NodePass *p, bool *modified) { | |||
| Status AlbumOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<AlbumOp>(), modified); | |||
| } | |||
| @@ -196,7 +196,7 @@ class AlbumOp : public ParallelOp, public RandomAccessOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -435,7 +435,7 @@ Status CelebAOp::Reset() { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status CelebAOp::Accept(NodePass *p, bool *modified) { | |||
| Status CelebAOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<CelebAOp>(), modified); | |||
| } | |||
| @@ -173,7 +173,7 @@ class CelebAOp : public ParallelOp, RandomAccessOp { | |||
| /// \param[in] p Pointer to the NodePass to be accepted | |||
| /// \param[out] modified Indicator if the node was changed at all | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -491,7 +491,7 @@ Status CifarOp::CountTotalRows(const std::string &dir, const std::string &usage, | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status CifarOp::Accept(NodePass *p, bool *modified) { | |||
| Status CifarOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<CifarOp>(), modified); | |||
| } | |||
| @@ -169,7 +169,7 @@ class CifarOp : public ParallelOp, public RandomAccessOp { | |||
| /// \param[in] p Pointer to the NodePass to be accepted | |||
| /// \param[out] modified Indicator if the node was changed at all | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -560,7 +560,7 @@ void ClueOp::MakeSimpleProducer() { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status ClueOp::Accept(NodePass *p, bool *modified) { | |||
| Status ClueOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<ClueOp>(), modified); | |||
| } | |||
| @@ -195,7 +195,7 @@ class ClueOp : public ParallelOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| private: | |||
| // The entry point for when workers are launched. | |||
| @@ -664,7 +664,7 @@ Status CocoOp::GetClassIndexing(const std::string &dir, const std::string &file, | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status CocoOp::Accept(NodePass *p, bool *modified) { | |||
| Status CocoOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<CocoOp>(), modified); | |||
| } | |||
| @@ -207,7 +207,7 @@ class CocoOp : public ParallelOp, public RandomAccessOp { | |||
| /// \param[in] p Pointer to the NodePass to be accepted | |||
| /// \param[out] modified Indicator if the node was changed at all | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -911,7 +911,7 @@ void CsvOp::MakeSimpleProducer() { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status CsvOp::Accept(NodePass *p, bool *modified) { | |||
| Status CsvOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<CsvOp>(), modified); | |||
| } | |||
| @@ -316,7 +316,7 @@ class CsvOp : public ParallelOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| private: | |||
| // The entry point for when workers are launched. | |||
| @@ -258,7 +258,7 @@ Status GeneratorOp::Reset() { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status GeneratorOp::Accept(NodePass *p, bool *modified) { | |||
| Status GeneratorOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<GeneratorOp>(), modified); | |||
| } | |||
| @@ -128,7 +128,7 @@ class GeneratorOp : public PipelineOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -449,7 +449,7 @@ Status ImageFolderOp::CountRowsAndClasses(const std::string &path, const std::se | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status ImageFolderOp::Accept(NodePass *p, bool *modified) { | |||
| Status ImageFolderOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<ImageFolderOp>(), modified); | |||
| } | |||
| @@ -211,7 +211,7 @@ class ImageFolderOp : public ParallelOp, public RandomAccessOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -436,7 +436,7 @@ Status ManifestOp::GetClassIndexing(const std::string &file, const py::dict &dic | |||
| #endif | |||
| // Visitor accept method for NodePass | |||
| Status ManifestOp::Accept(NodePass *p, bool *modified) { | |||
| Status ManifestOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<ManifestOp>(), modified); | |||
| } | |||
| @@ -184,7 +184,7 @@ class ManifestOp : public ParallelOp, public RandomAccessOp { | |||
| /// \param[in] p Pointer to the NodePass to be accepted | |||
| /// \param[out] modified Indicator if the node was changed at all | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -458,7 +458,7 @@ Status MindRecordOp::CountTotalRows(const std::vector<std::string> dataset_path, | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status MindRecordOp::Accept(NodePass *p, bool *modified) { | |||
| Status MindRecordOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<MindRecordOp>(), modified); | |||
| } | |||
| @@ -206,7 +206,7 @@ class MindRecordOp : public ParallelOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -454,7 +454,7 @@ Status MnistOp::CountTotalRows(const std::string &dir, const std::string &usage, | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status MnistOp::Accept(NodePass *p, bool *modified) { | |||
| Status MnistOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<MnistOp>(), modified); | |||
| } | |||
| @@ -162,7 +162,7 @@ class MnistOp : public ParallelOp, public RandomAccessOp { | |||
| /// \param[in] p Pointer to the NodePass to be accepted | |||
| /// \param[out] modified Indicator if the node was changed at all | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -410,7 +410,7 @@ Status RandomDataOp::Reset() { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status RandomDataOp::Accept(NodePass *p, bool *modified) { | |||
| Status RandomDataOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<RandomDataOp>(), modified); | |||
| } | |||
| @@ -263,7 +263,7 @@ class RandomDataOp : public ParallelOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Private function for computing the assignment of the column name map. | |||
| // @return - Status | |||
| @@ -515,7 +515,7 @@ void TextFileOp::MakeSimpleProducer() { | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status TextFileOp::Accept(NodePass *p, bool *modified) { | |||
| Status TextFileOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<TextFileOp>(), modified); | |||
| } | |||
| @@ -196,7 +196,7 @@ class TextFileOp : public ParallelOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| private: | |||
| // The entry point for when workers are launched. | |||
| @@ -1024,7 +1024,7 @@ int64_t TFReaderOp::CountTotalRowsSectioned(const std::vector<std::string> &file | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status TFReaderOp::Accept(NodePass *p, bool *modified) { | |||
| Status TFReaderOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<TFReaderOp>(), modified); | |||
| } | |||
| @@ -236,7 +236,7 @@ class TFReaderOp : public ParallelOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -493,7 +493,7 @@ Status VOCOp::GetClassIndexing(const std::string &dir, const std::string &task_t | |||
| #endif | |||
| // Visitor accept method for NodePass | |||
| Status VOCOp::Accept(NodePass *p, bool *modified) { | |||
| Status VOCOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<VOCOp>(), modified); | |||
| } | |||
| @@ -210,7 +210,7 @@ class VOCOp : public ParallelOp, public RandomAccessOp { | |||
| /// \param[in] p Pointer to the NodePass to be accepted | |||
| /// \param[out] modified Indicator if the node was changed at all | |||
| /// \return Status of the node visit | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -128,13 +128,13 @@ Status TakeOp::FillBuffer(std::unique_ptr<DataBuffer> *buffer, std::unique_ptr<D | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status TakeOp::Accept(NodePass *p, bool *modified) { | |||
| Status TakeOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<TakeOp>(), modified); | |||
| } | |||
| // Visitor pre-accept method for NodePass | |||
| Status TakeOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status TakeOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->PreRunOnNode(shared_from_base<TakeOp>(), modified); | |||
| } | |||
| @@ -82,13 +82,13 @@ class TakeOp : public PipelineOp { | |||
| // @param p - Pointer to the NodePass to be accepted. | |||
| // @param modified - Whether this node visit modified the pipeline. | |||
| // @return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| /// \brief Base-class override for NodePass pre-visit acceptor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -237,13 +237,13 @@ Status ZipOp::EoeReceived(int32_t) { | |||
| } | |||
| // Visitor pre-accept method for NodePass | |||
| Status ZipOp::PreAccept(NodePass *p, bool *modified) { | |||
| Status ZipOp::PreAccept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->PreRunOnNode(shared_from_base<ZipOp>(), modified); | |||
| } | |||
| // Visitor accept method for NodePass | |||
| Status ZipOp::Accept(NodePass *p, bool *modified) { | |||
| Status ZipOp::Accept(NodePass *p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->RunOnNode(shared_from_base<ZipOp>(), modified); | |||
| } | |||
| @@ -108,13 +108,13 @@ class ZipOp : public PipelineOp { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status PreAccept(NodePass *p, bool *modified) override; | |||
| Status PreAccept(NodePass *p, bool *const modified) override; | |||
| /// \brief Base-class override for NodePass visitor acceptor. | |||
| /// \param[in] p Pointer to the NodePass to be accepted. | |||
| /// \param[out] modified Whether this node visit modified the pipeline. | |||
| /// \return - Status of the node visit. | |||
| Status Accept(NodePass *p, bool *modified) override; | |||
| Status Accept(NodePass *p, bool *const modified) override; | |||
| // Op name getter | |||
| // @return Name of the current Op | |||
| @@ -142,13 +142,13 @@ Status BatchNode::GetDatasetSize(const std::shared_ptr<DatasetSizeGetter> &size_ | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status BatchNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status BatchNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<BatchNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status BatchNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status BatchNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<BatchNode>(), modified); | |||
| } | |||
| @@ -79,13 +79,13 @@ class BatchNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| private: | |||
| int32_t batch_size_; | |||
| @@ -92,13 +92,13 @@ Status BuildSentenceVocabNode::ValidateParams() { | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status BuildSentenceVocabNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status BuildSentenceVocabNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<BuildSentenceVocabNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status BuildSentenceVocabNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status BuildSentenceVocabNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<BuildSentenceVocabNode>(), modified); | |||
| } | |||
| @@ -63,13 +63,13 @@ class BuildSentenceVocabNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| private: | |||
| std::shared_ptr<SentencePieceVocab> vocab_; | |||
| @@ -87,13 +87,13 @@ Status BuildVocabNode::ValidateParams() { | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status BuildVocabNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status BuildVocabNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<BuildVocabNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status BuildVocabNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status BuildVocabNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<BuildVocabNode>(), modified); | |||
| } | |||
| @@ -62,13 +62,13 @@ class BuildVocabNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| private: | |||
| std::shared_ptr<Vocab> vocab_; | |||
| @@ -84,13 +84,13 @@ Status ConcatNode::Build(std::vector<std::shared_ptr<DatasetOp>> *const node_ops | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status ConcatNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status ConcatNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<ConcatNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status ConcatNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status ConcatNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<ConcatNode>(), modified); | |||
| } | |||
| @@ -70,13 +70,13 @@ class ConcatNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| }; | |||
| } // namespace dataset | |||
| @@ -376,14 +376,14 @@ Status DatasetNode::Remove() { | |||
| } | |||
| // In DFS tree traversal, each node is visited twice. Accept is called on the first visit. | |||
| Status DatasetNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status DatasetNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // This method will only be called if its derived class does not implement one. | |||
| return p->Visit(shared_from_this(), modified); | |||
| } | |||
| // In DFS tree traversal, each node is visited twice. AcceptAfter is called on the second visit | |||
| // after all child nodes are visited. | |||
| Status DatasetNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status DatasetNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // This method will only be called if its derived class does not implement one. | |||
| return p->VisitAfter(shared_from_this(), modified); | |||
| } | |||
| @@ -431,11 +431,11 @@ Status DatasetNode::ValidateParams() { | |||
| return Status::OK(); | |||
| } | |||
| Status MappableSourceNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status MappableSourceNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| return p->Visit(shared_from_base<MappableSourceNode>(), modified); | |||
| } | |||
| Status NonMappableSourceNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status NonMappableSourceNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| return p->Visit(shared_from_base<MappableSourceNode>(), modified); | |||
| } | |||
| @@ -246,7 +246,7 @@ class DatasetNode : public std::enable_shared_from_this<DatasetNode> { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| virtual Status Accept(IRNodePass *p, bool *modified); | |||
| virtual Status Accept(IRNodePass *const p, bool *const modified); | |||
| /// \brief Base method for IRNodePass visit on the way back up the tree after its descendants are visited. | |||
| /// \notes Subclass needs to override this if it requires special node visit access. | |||
| @@ -254,7 +254,7 @@ class DatasetNode : public std::enable_shared_from_this<DatasetNode> { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| virtual Status AcceptAfter(IRNodePass *p, bool *modified); | |||
| virtual Status AcceptAfter(IRNodePass *const p, bool *const modified); | |||
| virtual bool IsSizeDefined() { return true; } | |||
| @@ -289,7 +289,7 @@ class MappableSourceNode : public DatasetNode { | |||
| descendant_of_cache_ = false; | |||
| } | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Destructor | |||
| ~MappableSourceNode() = default; | |||
| @@ -313,7 +313,7 @@ class NonMappableSourceNode : public DatasetNode { | |||
| descendant_of_cache_ = false; | |||
| } | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Destructor | |||
| ~NonMappableSourceNode() = default; | |||
| @@ -62,13 +62,13 @@ Status FilterNode::ValidateParams() { | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status FilterNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status FilterNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<FilterNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status FilterNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status FilterNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<FilterNode>(), modified); | |||
| } | |||
| @@ -62,13 +62,13 @@ class FilterNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| private: | |||
| std::shared_ptr<TensorOp> predicate_; | |||
| @@ -107,13 +107,13 @@ Status MapNode::ValidateParams() { | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status MapNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status MapNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<MapNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status MapNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status MapNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<MapNode>(), modified); | |||
| } | |||
| @@ -66,13 +66,13 @@ class MapNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief clear all callbacks | |||
| void ClearCallbacks() { callbacks_.clear(); } | |||
| @@ -72,13 +72,13 @@ Status RepeatNode::GetDatasetSize(const std::shared_ptr<DatasetSizeGetter> &size | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status RepeatNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status RepeatNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<RepeatNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status RepeatNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status RepeatNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<RepeatNode>(), modified); | |||
| } | |||
| @@ -74,13 +74,13 @@ class RepeatNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| private: | |||
| int32_t repeat_count_; | |||
| @@ -76,13 +76,13 @@ Status RootNode::ValidateParams() { | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status RootNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status RootNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<RootNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status RootNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status RootNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<RootNode>(), modified); | |||
| } | |||
| @@ -68,13 +68,13 @@ class RootNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| private: | |||
| int32_t num_epochs_; | |||
| @@ -73,13 +73,13 @@ Status SkipNode::GetDatasetSize(const std::shared_ptr<DatasetSizeGetter> &size_g | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status SkipNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status SkipNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<SkipNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status SkipNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status SkipNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<SkipNode>(), modified); | |||
| } | |||
| @@ -72,13 +72,13 @@ class SkipNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| private: | |||
| int32_t skip_count_; | |||
| @@ -71,13 +71,13 @@ Status TakeNode::GetDatasetSize(const std::shared_ptr<DatasetSizeGetter> &size_g | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status TakeNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status TakeNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<TakeNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status TakeNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status TakeNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<TakeNode>(), modified); | |||
| } | |||
| @@ -72,13 +72,13 @@ class TakeNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| private: | |||
| int32_t take_count_; | |||
| @@ -106,13 +106,13 @@ Status TransferNode::Build(std::vector<std::shared_ptr<DatasetOp>> *const node_o | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status TransferNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status TransferNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<TransferNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status TransferNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status TransferNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<TransferNode>(), modified); | |||
| } | |||
| @@ -62,13 +62,13 @@ class TransferNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| private: | |||
| std::string queue_name_; | |||
| @@ -81,13 +81,13 @@ Status ZipNode::GetDatasetSize(const std::shared_ptr<DatasetSizeGetter> &size_ge | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status ZipNode::Accept(IRNodePass *const p, bool *modified) { | |||
| Status ZipNode::Accept(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->Visit(shared_from_base<ZipNode>(), modified); | |||
| } | |||
| // Visitor accepting method for IRNodePass | |||
| Status ZipNode::AcceptAfter(IRNodePass *const p, bool *modified) { | |||
| Status ZipNode::AcceptAfter(IRNodePass *const p, bool *const modified) { | |||
| // Downcast shared pointer then call visitor | |||
| return p->VisitAfter(shared_from_base<ZipNode>(), modified); | |||
| } | |||
| @@ -68,13 +68,13 @@ class ZipNode : public DatasetNode { | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status Accept(IRNodePass *p, bool *modified) override; | |||
| Status Accept(IRNodePass *const p, bool *const modified) override; | |||
| /// \brief Base-class override for accepting IRNodePass visitor | |||
| /// \param[in] p The node to visit | |||
| /// \param[out] modified Indicator if the node was modified | |||
| /// \return Status of the node visit | |||
| Status AcceptAfter(IRNodePass *p, bool *modified) override; | |||
| Status AcceptAfter(IRNodePass *const p, bool *const modified) override; | |||
| private: | |||
| std::vector<std::shared_ptr<DatasetNode>> datasets_; | |||
| @@ -29,7 +29,7 @@ | |||
| namespace mindspore { | |||
| namespace dataset { | |||
| Status TensorOpFusionPass::Visit(std::shared_ptr<MapNode> node, bool *modified) { | |||
| Status TensorOpFusionPass::Visit(std::shared_ptr<MapNode> node, bool *const modified) { | |||
| std::vector<std::shared_ptr<TensorOperation>> ops = node->operations(); | |||
| // start temporary code, to deal with pre-built TensorOperation | |||
| @@ -30,7 +30,7 @@ class TensorOpFusionPass : public IRNodePass { | |||
| /// \param[in] node The node being visited | |||
| /// \param[inout] *modified indicates whether the node has been visited | |||
| /// \return Status The status code returned | |||
| Status Visit(std::shared_ptr<MapNode> node, bool *modified) override; | |||
| Status Visit(std::shared_ptr<MapNode> node, bool *const modified) override; | |||
| }; | |||
| } // namespace dataset | |||
| } // namespace mindspore | |||
| @@ -87,7 +87,7 @@ namespace mindspore { | |||
| namespace dataset { | |||
| // Driver method for TreePass | |||
| Status IRTreePass::Run(std::shared_ptr<DatasetNode> root_ir, bool *modified) { | |||
| Status IRTreePass::Run(std::shared_ptr<DatasetNode> root_ir, bool *const modified) { | |||
| if (root_ir == nullptr || modified == nullptr) { | |||
| return Status(StatusCode::kUnexpectedError, "Null pointer passed to TreePass"); | |||
| } | |||
| @@ -97,7 +97,7 @@ Status IRTreePass::Run(std::shared_ptr<DatasetNode> root_ir, bool *modified) { | |||
| } | |||
| // Driver method for NodePass | |||
| Status IRNodePass::Run(std::shared_ptr<DatasetNode> root_ir, bool *modified) { | |||
| Status IRNodePass::Run(std::shared_ptr<DatasetNode> root_ir, bool *const modified) { | |||
| if (root_ir == nullptr || modified == nullptr) { | |||
| return Status(StatusCode::kUnexpectedError, "Null pointer passed to NodePass"); | |||
| } | |||
| @@ -114,7 +114,7 @@ Status IRNodePass::Run(std::shared_ptr<DatasetNode> root_ir, bool *modified) { | |||
| } | |||
| // Helper function to perform DFS visit | |||
| Status IRNodePass::DFSNodeVisit(std::shared_ptr<DatasetNode> node_ir, bool *modified) { | |||
| Status IRNodePass::DFSNodeVisit(std::shared_ptr<DatasetNode> node_ir, bool *const modified) { | |||
| bool m = false; | |||
| RETURN_IF_NOT_OK(node_ir->Accept(this, &m)); | |||
| @@ -129,7 +129,7 @@ Status IRNodePass::DFSNodeVisit(std::shared_ptr<DatasetNode> node_ir, bool *modi | |||
| } | |||
| // Helper function to perform BFS visit | |||
| Status IRNodePass::BFSNodeVisit(std::shared_ptr<DatasetNode> node_ir, bool *modified) { | |||
| Status IRNodePass::BFSNodeVisit(std::shared_ptr<DatasetNode> node_ir, bool *const modified) { | |||
| bool m = false; | |||
| // Initialize bfs queue with root | |||
| @@ -155,126 +155,126 @@ Status IRNodePass::BFSNodeVisit(std::shared_ptr<DatasetNode> node_ir, bool *modi | |||
| } | |||
| // For non-leaf IR node | |||
| Status IRNodePass::Visit(std::shared_ptr<BatchNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<BatchNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<BatchNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<BatchNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<BucketBatchByLengthNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<BucketBatchByLengthNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<BucketBatchByLengthNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<BucketBatchByLengthNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<BuildVocabNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<BuildVocabNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<BuildVocabNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<BuildVocabNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<ConcatNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<ConcatNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<ConcatNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<ConcatNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<FilterNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<FilterNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<FilterNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<FilterNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<MapNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<MapNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<MapNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<MapNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<ProjectNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<ProjectNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<ProjectNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<ProjectNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<RenameNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<RenameNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<RenameNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<RenameNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<RepeatNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<RepeatNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<RepeatNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<RepeatNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<RootNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<RootNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<RootNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<RootNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<ShuffleNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<ShuffleNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<ShuffleNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<ShuffleNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<SkipNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<SkipNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<SkipNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<SkipNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<TakeNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<TakeNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<TakeNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<TakeNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<TransferNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<TransferNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<TransferNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<TransferNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<ZipNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<ZipNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<ZipNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<ZipNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| #ifdef ENABLE_PYTHON | |||
| Status IRNodePass::Visit(std::shared_ptr<SyncWaitNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<SyncWaitNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<SyncWaitNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<SyncWaitNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| #endif | |||
| #ifndef ENABLE_ANDROID | |||
| Status IRNodePass::Visit(std::shared_ptr<BuildSentenceVocabNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<BuildSentenceVocabNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<BuildSentenceVocabNode> node, bool *modified) { | |||
| Status IRNodePass::VisitAfter(std::shared_ptr<BuildSentenceVocabNode> node, bool *const modified) { | |||
| return VisitAfter(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| #endif | |||
| // leaf-IR Node | |||
| Status IRNodePass::Visit(std::shared_ptr<MappableSourceNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<MappableSourceNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| Status IRNodePass::Visit(std::shared_ptr<NonMappableSourceNode> node, bool *modified) { | |||
| Status IRNodePass::Visit(std::shared_ptr<NonMappableSourceNode> node, bool *const modified) { | |||
| return Visit(std::static_pointer_cast<DatasetNode>(node), modified); | |||
| } | |||
| ////////////////////////////////// | |||
| // This section of code will be removed once the migration of optimizer from DatasetOp to DatasetNode is done. | |||
| // Driver method for TreePass | |||
| Status TreePass::Run(ExecutionTree *tree, bool *modified) { | |||
| Status TreePass::Run(ExecutionTree *tree, bool *const modified) { | |||
| if (tree == nullptr || modified == nullptr) { | |||
| return Status(StatusCode::kUnexpectedError, "Null pointer passed to TreePass"); | |||
| } | |||
| @@ -284,7 +284,7 @@ Status TreePass::Run(ExecutionTree *tree, bool *modified) { | |||
| } | |||
| // Driver method for NodePass | |||
| Status NodePass::Run(ExecutionTree *tree, bool *modified) { | |||
| Status NodePass::Run(ExecutionTree *tree, bool *const modified) { | |||
| if (tree == nullptr || modified == nullptr) { | |||
| return Status(StatusCode::kUnexpectedError, "Null pointer passed to NodePass"); | |||
| } | |||
| @@ -302,7 +302,7 @@ Status NodePass::Run(ExecutionTree *tree, bool *modified) { | |||
| } | |||
| // Helper function to perform DFS visit | |||
| Status NodePass::DFSNodeVisit(std::shared_ptr<DatasetOp> node, bool *modified) { | |||
| Status NodePass::DFSNodeVisit(std::shared_ptr<DatasetOp> node, bool *const modified) { | |||
| RETURN_IF_NOT_OK(node->PreAccept(this, modified)); | |||
| for (const auto &c : node->Children()) { | |||
| RETURN_IF_NOT_OK(this->DFSNodeVisit(c, modified)); | |||
| @@ -311,7 +311,7 @@ Status NodePass::DFSNodeVisit(std::shared_ptr<DatasetOp> node, bool *modified) { | |||
| } | |||
| // Helper function to perform BFS visit | |||
| Status NodePass::BFSNodeVisit(std::shared_ptr<DatasetOp> root, bool *modified) { | |||
| Status NodePass::BFSNodeVisit(std::shared_ptr<DatasetOp> root, bool *const modified) { | |||
| // Initialize bfs queue with root | |||
| std::queue<std::shared_ptr<DatasetOp>> bfsQueue; | |||
| bfsQueue.push(root); | |||
| @@ -333,220 +333,220 @@ Status NodePass::BFSNodeVisit(std::shared_ptr<DatasetOp> root, bool *modified) { | |||
| return Status::OK(); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<BatchOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<BatchOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<MapOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<MapOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<ProjectOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<ProjectOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<RenameOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<RenameOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<SkipOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<SkipOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<ShuffleOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<ShuffleOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<RandomDataOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<RandomDataOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<TakeOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<TakeOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<ZipOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<ZipOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<DeviceQueueOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<DeviceQueueOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<ImageFolderOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<ImageFolderOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<AlbumOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<AlbumOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<MnistOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<MnistOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<CifarOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<CifarOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<CelebAOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<CelebAOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<CocoOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<CocoOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<RepeatOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<RepeatOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<EpochCtrlOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<EpochCtrlOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<RepeatOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<RepeatOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<EpochCtrlOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<EpochCtrlOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<BuildVocabOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<BuildVocabOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<ZipOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<ZipOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<MapOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<MapOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<ConcatOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<ConcatOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<TakeOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<TakeOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<SkipOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<SkipOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<BatchOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<BatchOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| #ifndef ENABLE_ANDROID | |||
| Status NodePass::RunOnNode(std::shared_ptr<MindRecordOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<MindRecordOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<TFReaderOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<TFReaderOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<CacheOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<CacheOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<CacheMergeOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<CacheMergeOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<CacheLookupOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<CacheLookupOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<ClueOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<ClueOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<CsvOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<CsvOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<TextFileOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<TextFileOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<CacheOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<CacheOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<CacheMergeOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<CacheMergeOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<BuildSentencePieceVocabOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<BuildSentencePieceVocabOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| #endif | |||
| #ifdef ENABLE_PYTHON | |||
| Status NodePass::RunOnNode(std::shared_ptr<FilterOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<FilterOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<GeneratorOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<GeneratorOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<ManifestOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<ManifestOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::RunOnNode(std::shared_ptr<VOCOp> node, bool *modified) { | |||
| Status NodePass::RunOnNode(std::shared_ptr<VOCOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return RunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<FilterOp> node, bool *modified) { | |||
| Status NodePass::PreRunOnNode(std::shared_ptr<FilterOp> node, bool *const modified) { | |||
| // Fallback to base class visitor by default | |||
| return PreRunOnNode(std::static_pointer_cast<DatasetOp>(node), modified); | |||
| } | |||
| @@ -118,7 +118,7 @@ class IRPass : public std::enable_shared_from_this<IRPass> { | |||
| // Run the transformation pass against the IR tree. | |||
| // @param root_ir - Pointer to the IR tree to be transformed. | |||
| // @param modified - Pointer to the modified flag, | |||
| virtual Status Run(std::shared_ptr<DatasetNode> root_ir, bool *modified) = 0; | |||
| virtual Status Run(std::shared_ptr<DatasetNode> root_ir, bool *const modified) = 0; | |||
| virtual ~IRPass() = default; | |||
| }; | |||
| @@ -129,14 +129,14 @@ class IRTreePass : public IRPass { | |||
| /// \brief Run the transformation pass against the IR tree. | |||
| /// \param[inout] root_ir Pointer to the IR tree to be transformed. | |||
| /// \param[inout] modified Indicate if the tree was modified | |||
| Status Run(std::shared_ptr<DatasetNode> root_ir, bool *modified) final; | |||
| Status Run(std::shared_ptr<DatasetNode> root_ir, bool *const modified) final; | |||
| /// \brief Derived classes may implement the runOnTree function to implement tree transformation. | |||
| /// "modified" flag needs to be set to true if tree is modified during the pass execution. | |||
| /// \param[inout] tree The tree to operate on. | |||
| /// \param[inout] Indicate if the tree was modified. | |||
| /// \return Status The status code returned | |||
| virtual Status RunOnTree(std::shared_ptr<DatasetNode> root_ir, bool *modified) { return Status::OK(); } | |||
| virtual Status RunOnTree(std::shared_ptr<DatasetNode> root_ir, bool *const modified) { return Status::OK(); } | |||
| }; | |||
| // IRNodePass is a base Pass class which performs transformation on node visiting. | |||
| @@ -164,21 +164,21 @@ class IRNodePass : public IRPass { | |||
| /// \brief Run the transformation pass against the IR tree | |||
| /// \param[inout] root_ir Pointer to the IR tree to be transformed | |||
| /// \param[inout] modified Indicator if the tree was changed | |||
| Status Run(std::shared_ptr<DatasetNode> root_ir, bool *modified) final; | |||
| Status Run(std::shared_ptr<DatasetNode> root_ir, bool *const modified) final; | |||
| /// \brief Derived classes may implement the Visit function to implement any initial visit work on the way down | |||
| /// a tree traversal. "modified" flag needs to be set to true if node is modified during the pass execution | |||
| /// \param[in] node The node being visited | |||
| /// \param[out] modified Indicator if the node was changed at all | |||
| /// \return Status The status code returned | |||
| virtual Status Visit(std::shared_ptr<DatasetNode> node, bool *modified) { return Status::OK(); } | |||
| virtual Status Visit(std::shared_ptr<DatasetNode> node, bool *const modified) { return Status::OK(); } | |||
| /// \brief Derived classes may implement the VisitAfter function to implement node level tree transformation | |||
| /// "modified" flag needs to be set to true if node is modified during the pass execution | |||
| /// \param[in] node The node being visited | |||
| /// \param[out] modified Indicator if the node was changed at all. | |||
| /// \return Status The status code returned | |||
| virtual Status VisitAfter(std::shared_ptr<DatasetNode> node, bool *modified) { return Status::OK(); } | |||
| virtual Status VisitAfter(std::shared_ptr<DatasetNode> node, bool *const modified) { return Status::OK(); } | |||
| // Visit()/VisitAfter() method to be overridden. | |||
| // These pairs of Visit()/VisitAfter() for each derived class of DatasetNode are defined here. | |||
| @@ -190,55 +190,55 @@ class IRNodePass : public IRPass { | |||
| // Note that virtual template functions are not permitted in C++. | |||
| // | |||
| // Non-leaf IR node | |||
| virtual Status Visit(std::shared_ptr<BatchNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<BatchNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<BucketBatchByLengthNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<BucketBatchByLengthNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<BuildVocabNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<BuildVocabNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<ConcatNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<ConcatNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<FilterNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<FilterNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<MapNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<MapNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<ProjectNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<ProjectNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<RenameNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<RenameNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<RepeatNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<RepeatNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<RootNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<RootNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<ShuffleNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<ShuffleNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<SkipNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<SkipNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<TakeNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<TakeNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<TransferNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<TransferNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<ZipNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<ZipNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<BatchNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<BatchNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<BucketBatchByLengthNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<BucketBatchByLengthNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<BuildVocabNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<BuildVocabNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<ConcatNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<ConcatNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<FilterNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<FilterNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<MapNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<MapNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<ProjectNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<ProjectNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<RenameNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<RenameNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<RepeatNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<RepeatNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<RootNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<RootNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<ShuffleNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<ShuffleNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<SkipNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<SkipNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<TakeNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<TakeNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<TransferNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<TransferNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<ZipNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<ZipNode> node, bool *const modified); | |||
| #ifdef ENABLE_PYTHON | |||
| virtual Status Visit(std::shared_ptr<SyncWaitNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<SyncWaitNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<SyncWaitNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<SyncWaitNode> node, bool *const modified); | |||
| #endif | |||
| #ifndef ENABLE_ANDROID | |||
| virtual Status Visit(std::shared_ptr<BuildSentenceVocabNode> node, bool *modified); | |||
| virtual Status VisitAfter(std::shared_ptr<BuildSentenceVocabNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<BuildSentenceVocabNode> node, bool *const modified); | |||
| virtual Status VisitAfter(std::shared_ptr<BuildSentenceVocabNode> node, bool *const modified); | |||
| #endif | |||
| // leaf-IR Node | |||
| virtual Status Visit(std::shared_ptr<MappableSourceNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<NonMappableSourceNode> node, bool *modified); | |||
| virtual Status Visit(std::shared_ptr<MappableSourceNode> node, bool *const modified); | |||
| virtual Status Visit(std::shared_ptr<NonMappableSourceNode> node, bool *const modified); | |||
| private: | |||
| // Helper function to perform DFS visit | |||
| Status DFSNodeVisit(std::shared_ptr<DatasetNode> node_ir, bool *modified); | |||
| Status DFSNodeVisit(std::shared_ptr<DatasetNode> node_ir, bool *const modified); | |||
| // Helper function to perform BFS visit | |||
| Status BFSNodeVisit(std::shared_ptr<DatasetNode> node_ir, bool *modified); | |||
| Status BFSNodeVisit(std::shared_ptr<DatasetNode> node_ir, bool *const modified); | |||
| // Tree traversal order of the NodePass | |||
| Order traversalOrder_; | |||
| @@ -253,7 +253,7 @@ class Pass : public std::enable_shared_from_this<Pass> { | |||
| // Run the transformation pass against the execution tree. | |||
| // @param tree - Pointer to the execution tree to be transformed. | |||
| // @param modified - Pointer to the modified flag, | |||
| virtual Status Run(ExecutionTree *tree, bool *modified) = 0; | |||
| virtual Status Run(ExecutionTree *tree, bool *const modified) = 0; | |||
| virtual ~Pass() = default; | |||
| }; | |||
| @@ -264,14 +264,14 @@ class TreePass : public Pass { | |||
| /// \brief Run the transformation pass against the execution tree. | |||
| /// \param[inout] tree Pointer to the execution tree to be transformed. | |||
| /// \param[inout] modified Indicate if the tree was modified | |||
| Status Run(ExecutionTree *tree, bool *modified) final; | |||
| Status Run(ExecutionTree *tree, bool *const modified) final; | |||
| /// \brief Derived classes may implement the runOnTree function to implement tree transformation. | |||
| /// "modified" flag needs to be set to true if tree is modified during the pass execution. | |||
| /// \param[inout] tree The tree to operate on. | |||
| /// \param[inout] Indicate of the tree was modified. | |||
| /// \return Status The status code returned | |||
| virtual Status RunOnTree(ExecutionTree *tree, bool *modified) { return Status::OK(); } | |||
| virtual Status RunOnTree(ExecutionTree *tree, bool *const modified) { return Status::OK(); } | |||
| }; | |||
| // NodePass is a base Pass class which performs transformation on node visiting. | |||
| @@ -299,79 +299,79 @@ class NodePass : public Pass { | |||
| /// \brief Run the transformation pass against the execution tree | |||
| /// \param[inout] tree Pointer to the execution tree to be transformed | |||
| /// \param[inout] modified Indicator if the tree was changed | |||
| Status Run(ExecutionTree *tree, bool *modified) final; | |||
| Status Run(ExecutionTree *tree, bool *const modified) final; | |||
| /// \brief Derived classes may implement the PreRunOnNode function to implement any initial visit work on the way down | |||
| /// a tree traversal. "modified" flag needs to be set to true if tree is modified during the pass execution | |||
| /// \param[in] node The node being visited | |||
| /// \param[out] modified Indicator if the node was changed at all | |||
| /// \return Status The status code returned | |||
| virtual Status PreRunOnNode(std::shared_ptr<DatasetOp> node, bool *modified) { return Status::OK(); } | |||
| virtual Status PreRunOnNode(std::shared_ptr<DatasetOp> node, bool *const modified) { return Status::OK(); } | |||
| /// \brief Derived classes may implement the RunOnNode function to implement node level tree transformation | |||
| /// "modified" flag needs to be set to true if tree is modified during the pass execution | |||
| /// \param[in] node The node being visited | |||
| /// \param[out] modified Indicator if the node was changed at all. | |||
| /// \return Status The status code returned | |||
| virtual Status RunOnNode(std::shared_ptr<DatasetOp> node, bool *modified) { return Status::OK(); } | |||
| virtual Status RunOnNode(std::shared_ptr<DatasetOp> node, bool *const modified) { return Status::OK(); } | |||
| // Visit methods to be overridden. | |||
| // Note that member template can not be virtual, any op which wants to work with NodePass should declare RunOnNode | |||
| // of its own type and override "Accept" from DatasetOp. | |||
| virtual Status RunOnNode(std::shared_ptr<BatchOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<MapOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ProjectOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<RenameOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<SkipOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ShuffleOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<RandomDataOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<AlbumOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<TakeOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ZipOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<DeviceQueueOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ImageFolderOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<MnistOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CifarOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CocoOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CelebAOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<RepeatOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<EpochCtrlOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<RepeatOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<EpochCtrlOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<BuildVocabOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<ZipOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<MapOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<ConcatOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<TakeOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<SkipOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<BatchOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<BatchOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<MapOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ProjectOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<RenameOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<SkipOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ShuffleOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<RandomDataOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<AlbumOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<TakeOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ZipOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<DeviceQueueOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ImageFolderOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<MnistOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CifarOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CocoOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CelebAOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<RepeatOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<EpochCtrlOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<RepeatOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<EpochCtrlOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<BuildVocabOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<ZipOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<MapOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<ConcatOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<TakeOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<SkipOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<BatchOp> node, bool *const modified); | |||
| #ifndef ENABLE_ANDROID | |||
| virtual Status RunOnNode(std::shared_ptr<MindRecordOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<TFReaderOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CacheMergeOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CacheLookupOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CacheOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ClueOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CsvOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<TextFileOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<CacheOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<CacheMergeOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<BuildSentencePieceVocabOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<MindRecordOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<TFReaderOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CacheMergeOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CacheLookupOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CacheOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ClueOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<CsvOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<TextFileOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<CacheOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<CacheMergeOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<BuildSentencePieceVocabOp> node, bool *const modified); | |||
| #endif | |||
| #ifdef ENABLE_PYTHON | |||
| virtual Status RunOnNode(std::shared_ptr<FilterOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ManifestOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<GeneratorOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<VOCOp> node, bool *modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<FilterOp> node, bool *modified); | |||
| virtual Status RunOnNode(std::shared_ptr<FilterOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<ManifestOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<GeneratorOp> node, bool *const modified); | |||
| virtual Status RunOnNode(std::shared_ptr<VOCOp> node, bool *const modified); | |||
| virtual Status PreRunOnNode(std::shared_ptr<FilterOp> node, bool *const modified); | |||
| #endif | |||
| private: | |||
| // Helper function to perform DFS visit | |||
| Status DFSNodeVisit(std::shared_ptr<DatasetOp> node, bool *modified); | |||
| Status DFSNodeVisit(std::shared_ptr<DatasetOp> node, bool *const modified); | |||
| // Helper function to perform BFS visit | |||
| Status BFSNodeVisit(std::shared_ptr<DatasetOp> root, bool *modified); | |||
| Status BFSNodeVisit(std::shared_ptr<DatasetOp> root, bool *const modified); | |||
| // Tree traversal order of the NodePass | |||
| Order traversalOrder_; | |||
| @@ -26,7 +26,7 @@ namespace mindspore { | |||
| namespace dataset { | |||
| // this will become the RootNode:DatasetNode when it is turned on | |||
| Status AutoWorkerPass::RunOnTree(std::shared_ptr<DatasetNode> root_ir, bool *modified) { | |||
| Status AutoWorkerPass::RunOnTree(std::shared_ptr<DatasetNode> root_ir, bool *const modified) { | |||
| uint8_t config = GlobalContext::config_manager()->get_auto_worker_config(); | |||
| OpWeightPass pass(kOpWeightConfigs[config < kOpWeightConfigs.size() ? config : 0]); | |||
| @@ -71,7 +71,7 @@ Status AutoWorkerPass::RunOnTree(std::shared_ptr<DatasetNode> root_ir, bool *mod | |||
| return Status::OK(); | |||
| } | |||
| Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<MapNode> node, bool *modified) { | |||
| Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<MapNode> node, bool *const modified) { | |||
| auto itr = weight_profile_.find(node->Name()); | |||
| CHECK_FAIL_RETURN_UNEXPECTED(itr != weight_profile_.end(), node->Name() + "'s weight doesn't exist."); | |||
| int32_t weight = itr->second; | |||
| @@ -80,7 +80,7 @@ Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<MapNode> node, bool * | |||
| return Status::OK(); | |||
| } | |||
| Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<BatchNode> node, bool *modified) { | |||
| Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<BatchNode> node, bool *const modified) { | |||
| auto itr = weight_profile_.find(node->Name()); | |||
| CHECK_FAIL_RETURN_UNEXPECTED(itr != weight_profile_.end(), node->Name() + "'s weight doesn't exist."); | |||
| int32_t weight = itr->second; | |||
| @@ -89,7 +89,7 @@ Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<BatchNode> node, bool | |||
| return Status::OK(); | |||
| } | |||
| Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<MappableSourceNode> node, bool *modified) { | |||
| Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<MappableSourceNode> node, bool *const modified) { | |||
| RETURN_OK_IF_TRUE(node->Name() == kGeneratorNode); // generator is pipeline op, skip this | |||
| auto itr = weight_profile_.find("MappableSource"); | |||
| CHECK_FAIL_RETURN_UNEXPECTED(itr != weight_profile_.end(), | |||
| @@ -100,7 +100,7 @@ Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<MappableSourceNode> n | |||
| return Status::OK(); | |||
| } | |||
| Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<NonMappableSourceNode> node, bool *modified) { | |||
| Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<NonMappableSourceNode> node, bool *const modified) { | |||
| auto itr = weight_profile_.find("NonMappableSourceNode"); | |||
| CHECK_FAIL_RETURN_UNEXPECTED(itr != weight_profile_.end(), | |||
| "NonLeafSource::" + node->Name() + "'s weight doesn't exist."); | |||
| @@ -110,7 +110,7 @@ Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<NonMappableSourceNode | |||
| return Status::OK(); | |||
| } | |||
| Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<DatasetNode> node, bool *modified) { | |||
| Status AutoWorkerPass::OpWeightPass::Visit(std::shared_ptr<DatasetNode> node, bool *const modified) { | |||
| weight_sum_ += GetNodeWeightFromProfile(node); | |||
| return Status::OK(); | |||
| } | |||
| @@ -63,13 +63,13 @@ class AutoWorkerPass : public IRTreePass { | |||
| // this is the base class function which contains the logic to handle most of the pipeline ops | |||
| // pipeline ops although can't config num_workers it still runs 1 thread they need to be factored into weight | |||
| Status Visit(std::shared_ptr<DatasetNode> node, bool *modified) override; | |||
| Status Visit(std::shared_ptr<DatasetNode> node, bool *const modified) override; | |||
| // these functions calculate the weights of more complex Nodes which may depend on its input arg. these functions | |||
| // will also push these nodes to a vector whose num_workers will be set int the Tree Pass | |||
| Status Visit(std::shared_ptr<BatchNode> node, bool *modified) override; | |||
| Status Visit(std::shared_ptr<MapNode> node, bool *modified) override; | |||
| Status Visit(std::shared_ptr<MappableSourceNode> node, bool *modified) override; | |||
| Status Visit(std::shared_ptr<NonMappableSourceNode> node, bool *modified) override; | |||
| Status Visit(std::shared_ptr<BatchNode> node, bool *const modified) override; | |||
| Status Visit(std::shared_ptr<MapNode> node, bool *const modified) override; | |||
| Status Visit(std::shared_ptr<MappableSourceNode> node, bool *const modified) override; | |||
| Status Visit(std::shared_ptr<NonMappableSourceNode> node, bool *const modified) override; | |||
| // helper function to look up weight according to the name of this Op. | |||
| float GetNodeWeightFromProfile(std::shared_ptr<DatasetNode> node); | |||