!23636 fix bug of modify weight between iterations

Merge pull request !23636 from limingqi107/bug_fix4
This commit is contained in:
i-robot 2021-09-17 09:26:14 +00:00 committed by Gitee
commit 71fda2959b
2 changed files with 7 additions and 11 deletions

View File

@ -120,16 +120,14 @@ void DataPrepareActor::PrepareData(const std::vector<std::vector<TensorPtr>> &in
OpContext<DeviceTensor> *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.

View File

@ -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<AID> data_source_aids_;