aboutsummaryrefslogtreecommitdiff
path: root/src/graph/mutators/InPlaceOperationMutator.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-06-18 15:35:09 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:53:20 +0000
commitd3a78ab634d3047bcb1615512b1b290dbfbca5f4 (patch)
treeae3453a1eee2a58e24cde9db1f1b0b8827e0e9e8 /src/graph/mutators/InPlaceOperationMutator.cpp
parentbe39f1281ee4ad4e83b92ad5a09f6bdc40b5718f (diff)
downloadComputeLibrary-d3a78ab634d3047bcb1615512b1b290dbfbca5f4.tar.gz
COMPMID-1283: (GitHub issue) after convolution output data is zero
During the mutating passes accessors of optimized nodes were dropped instead of being transfered to appropriate tensors. Change-Id: I29183984d94806bdfb5c92af3acefd928c0fd171 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/136036 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/graph/mutators/InPlaceOperationMutator.cpp')
-rw-r--r--src/graph/mutators/InPlaceOperationMutator.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/graph/mutators/InPlaceOperationMutator.cpp b/src/graph/mutators/InPlaceOperationMutator.cpp
index bd3f098965..31921b328e 100644
--- a/src/graph/mutators/InPlaceOperationMutator.cpp
+++ b/src/graph/mutators/InPlaceOperationMutator.cpp
@@ -50,11 +50,26 @@ void InPlaceOperationMutator::mutate(Graph &g)
// Check if parent has a single output if yes then force in place calculation else not
if((input_edge != nullptr) && (input_edge->producer() != nullptr) && (input_edge->producer()->output_edges().size() == 1))
{
- ARM_COMPUTE_LOG_GRAPH_VERBOSE("Switching to in-place computation for the node with ID : "
- << node->id() << " and name : " << node->name() << std::endl);
- // Update output
- auto tensor = input_edge->tensor();
- node->set_output_tensor(tensor->id(), 0);
+ // Get current and new output tensors
+ auto current_output_tensor = node->output(0);
+ auto new_output_tensor = input_edge->tensor();
+
+ ARM_COMPUTE_ERROR_ON(current_output_tensor == nullptr || new_output_tensor == nullptr);
+
+ // Prevent in-place operation if there is an accessor bound to the in-place tensor
+ if(new_output_tensor->accessor() == nullptr)
+ {
+ ARM_COMPUTE_LOG_GRAPH_VERBOSE("Switching to in-place computation for the node with ID : "
+ << node->id() << " and name : " << node->name() << std::endl);
+ // Update accessor
+ new_output_tensor->set_accessor(current_output_tensor->extract_accessor());
+ // Update output
+ node->set_output_tensor(new_output_tensor->id(), 0);
+ }
+ else
+ {
+ ARM_COMPUTE_LOG_GRAPH_VERBOSE("Prevented in-place operation as there is an accessor bound to the input tensor\n");
+ }
}
}
}