diff --git a/ngraph_bridge/ngraph_encapsulate_op_utils.cc b/ngraph_bridge/ngraph_encapsulate_op_utils.cc index d12494e45..ea893160b 100644 --- a/ngraph_bridge/ngraph_encapsulate_op_utils.cc +++ b/ngraph_bridge/ngraph_encapsulate_op_utils.cc @@ -99,10 +99,10 @@ Status GetPipelinedIOTensorsReadyForExecution( get<2>(io_tensors_next_iter)}; if (current_iter_pipeline_depth != (!next_io_tensor_bundle.Id)) { - return errors::Internal("Current Pipeline Depth is ", - current_iter_pipeline_depth, - " and next iter pipeline depth is also ", - next_io_tensor_bundle.Id); + delete shared_data; + return errors::Internal( + "Current Pipeline Depth is ", current_iter_pipeline_depth, + " and next iter pipeline depth is also ", next_io_tensor_bundle.Id); } shared_data->AddNextIOTensorBundleForDeviceTransfer( @@ -154,6 +154,7 @@ Status GetPipelinedIOTensorsReadyForExecution( NGRAPH_VLOG(2) << "[PREFETCH] COMPUTE: Using device tensors"; } shared_data->IncrSkipCount(); + shared_data->Unref(); } }