diff --git a/mindspore/ccsrc/runtime/framework/actor/data_prepare_actor.cc b/mindspore/ccsrc/runtime/framework/actor/data_prepare_actor.cc index fd1bf5766a8..26897c0c485 100644 --- a/mindspore/ccsrc/runtime/framework/actor/data_prepare_actor.cc +++ b/mindspore/ccsrc/runtime/framework/actor/data_prepare_actor.cc @@ -120,16 +120,14 @@ void DataPrepareActor::PrepareData(const std::vector> &in OpContext *const context) { MS_EXCEPTION_IF_NULL(context); - if (first_running_) { + // Convert actor running data from input tensors. + if (input_tensors.size() > 0) { PrepareDataForDeviceTensorStore(input_tensors, context); - // The step execution mode has no concept of first running. - first_running_ = (strategy_ == GraphExecutionStrategy::kStep) ? true : false; - } - - if (strategy_ == GraphExecutionStrategy::kPipeline) { - PrepareDataForHostTensorQueue(input_tensors, context); - } else if (strategy_ == GraphExecutionStrategy::kStep) { - PrepareDataForStepMode(input_tensors, context); + if (strategy_ == GraphExecutionStrategy::kPipeline) { + PrepareDataForHostTensorQueue(input_tensors, context); + } else if (strategy_ == GraphExecutionStrategy::kStep) { + PrepareDataForStepMode(input_tensors, context); + } } // Allocate continuous memory and send output to trigger the step running. diff --git a/mindspore/ccsrc/runtime/framework/actor/data_prepare_actor.h b/mindspore/ccsrc/runtime/framework/actor/data_prepare_actor.h index a0c95d487d7..e83fba12ade 100644 --- a/mindspore/ccsrc/runtime/framework/actor/data_prepare_actor.h +++ b/mindspore/ccsrc/runtime/framework/actor/data_prepare_actor.h @@ -45,7 +45,6 @@ class DataPrepareActor : public MemoryAwareActor { strategy_(GraphExecutionStrategy::kPipeline), host_data_source_actor_(host_data_source_actor), host_tensor_queue_(host_tensor_queue), - first_running_(true), loop_count_aid_(nullptr) {} ~DataPrepareActor() override = default; @@ -98,7 +97,6 @@ class DataPrepareActor : public MemoryAwareActor { GraphExecutionStrategy strategy_; HostQueueDSActorPtr host_data_source_actor_; HostTensorQueuePtr host_tensor_queue_; - bool first_running_; // The output controls contain the data source actors and the no input kernel actors. std::vector data_source_aids_;