diff options
Diffstat (limited to 'src/graph2/nodes')
-rw-r--r-- | src/graph2/nodes/ActivationLayerNode.cpp | 83 | ||||
-rw-r--r-- | src/graph2/nodes/BatchNormalizationLayerNode.cpp | 94 | ||||
-rw-r--r-- | src/graph2/nodes/ConstNode.cpp | 72 | ||||
-rw-r--r-- | src/graph2/nodes/ConvolutionLayerNode.cpp | 111 | ||||
-rw-r--r-- | src/graph2/nodes/DepthConcatenateLayerNode.cpp | 133 | ||||
-rw-r--r-- | src/graph2/nodes/DepthwiseConvolutionLayerNode.cpp | 110 | ||||
-rw-r--r-- | src/graph2/nodes/EltwiseLayerNode.cpp | 83 | ||||
-rw-r--r-- | src/graph2/nodes/FlattenLayerNode.cpp | 80 | ||||
-rw-r--r-- | src/graph2/nodes/FullyConnectedLayer.cpp | 107 | ||||
-rw-r--r-- | src/graph2/nodes/InputNode.cpp | 72 | ||||
-rw-r--r-- | src/graph2/nodes/NormalizationLayerNode.cpp | 84 | ||||
-rw-r--r-- | src/graph2/nodes/OutputNode.cpp | 66 | ||||
-rw-r--r-- | src/graph2/nodes/PoolingLayerNode.cpp | 103 | ||||
-rw-r--r-- | src/graph2/nodes/ReshapeLayer.cpp | 81 | ||||
-rw-r--r-- | src/graph2/nodes/SoftmaxLayerNode.cpp | 84 | ||||
-rw-r--r-- | src/graph2/nodes/SplitLayerNode.cpp | 117 |
16 files changed, 0 insertions, 1480 deletions
diff --git a/src/graph2/nodes/ActivationLayerNode.cpp b/src/graph2/nodes/ActivationLayerNode.cpp deleted file mode 100644 index c7c36e9bbd..0000000000 --- a/src/graph2/nodes/ActivationLayerNode.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/ActivationLayerNode.h" - -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -ActivationLayerNode::ActivationLayerNode(ActivationLayerInfo info) - : _info(info) -{ - _input_edges.resize(1, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -ActivationLayerInfo ActivationLayerNode::activation_info() const -{ - return _info; -} - -bool ActivationLayerNode::forward_descriptors() -{ - if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor ActivationLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - ARM_COMPUTE_ERROR_ON(idx >= _outputs.size()); - - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); - - return src->desc(); -} - -Status ActivationLayerNode::validate() -{ - return Status{}; -} - -NodeType ActivationLayerNode::type() const -{ - return NodeType::ActivationLayer; -} - -void ActivationLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/BatchNormalizationLayerNode.cpp b/src/graph2/nodes/BatchNormalizationLayerNode.cpp deleted file mode 100644 index b9f634210c..0000000000 --- a/src/graph2/nodes/BatchNormalizationLayerNode.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/BatchNormalizationLayerNode.h" - -#include "arm_compute/core/Utils.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -BatchNormalizationLayerNode::BatchNormalizationLayerNode(float epsilon, ActivationLayerInfo fused_activation) - : _epsilon(epsilon), _fused_activation(fused_activation) -{ - _input_edges.resize(5, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -float BatchNormalizationLayerNode::epsilon() const -{ - return _epsilon; -} - -ActivationLayerInfo BatchNormalizationLayerNode::fused_activation() const -{ - return _fused_activation; -} - -void BatchNormalizationLayerNode::set_fused_activation(ActivationLayerInfo fused_activation) -{ - _fused_activation = fused_activation; -} - -bool BatchNormalizationLayerNode::forward_descriptors() -{ - if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor BatchNormalizationLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - ARM_COMPUTE_ERROR_ON(idx >= _outputs.size()); - - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); - - return src->desc(); -} - -Status BatchNormalizationLayerNode::validate() -{ - return Status{}; -} - -NodeType BatchNormalizationLayerNode::type() const -{ - return NodeType::BatchNormalizationLayer; -} - -void BatchNormalizationLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/ConstNode.cpp b/src/graph2/nodes/ConstNode.cpp deleted file mode 100644 index 5bd6a8180c..0000000000 --- a/src/graph2/nodes/ConstNode.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/ConstNode.h" - -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -ConstNode::ConstNode(TensorDescriptor desc) - : _desc(desc) -{ - _outputs.resize(1, NullTensorID); -} - -bool ConstNode::forward_descriptors() -{ - if(output_id(0) != NullTensorID) - { - Tensor *t = output(0); - ARM_COMPUTE_ERROR_ON(t == nullptr); - t->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor ConstNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - return _desc; -} - -Status ConstNode::validate() -{ - return Status{}; -} - -NodeType ConstNode::type() const -{ - return NodeType::Const; -} - -void ConstNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute diff --git a/src/graph2/nodes/ConvolutionLayerNode.cpp b/src/graph2/nodes/ConvolutionLayerNode.cpp deleted file mode 100644 index 499b3520b2..0000000000 --- a/src/graph2/nodes/ConvolutionLayerNode.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/ConvolutionLayerNode.h" - -#include "arm_compute/core/Utils.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -ConvolutionLayerNode::ConvolutionLayerNode(PadStrideInfo info, ConvolutionMethod method) - : _info(std::move(info)), _method(method) -{ - _input_edges.resize(3, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -void ConvolutionLayerNode::set_convolution_method(ConvolutionMethod method) -{ - _method = method; -} - -ConvolutionMethod ConvolutionLayerNode::convolution_method() const -{ - return _method; -} - -PadStrideInfo ConvolutionLayerNode::convolution_info() const -{ - return _info; -} - -TensorShape ConvolutionLayerNode::compute_output_shape(TensorShape input_shape, TensorShape weights_shape, PadStrideInfo info) -{ - unsigned int output_width = 0; - unsigned int output_height = 0; - std::tie(output_width, output_height) = scaled_dimensions(input_shape.x(), input_shape.y(), weights_shape.x(), weights_shape.y(), info); - - TensorShape output_shape{ input_shape }; - output_shape.set(0, output_width); - output_shape.set(1, output_height); - output_shape.set(2, weights_shape[3]); - - return output_shape; -} - -bool ConvolutionLayerNode::forward_descriptors() -{ - if((input_id(0) != NullTensorID) && (input_id(1) != NullTensorID) && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor ConvolutionLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - const Tensor *src = input(0); - const Tensor *weights = input(1); - - ARM_COMPUTE_ERROR_ON(src == nullptr || weights == nullptr); - - TensorDescriptor output_info = src->desc(); - TensorShape output_shape = compute_output_shape(src->desc().shape, weights->desc().shape, _info); - output_info.shape = output_shape; - return output_info; -} - -Status ConvolutionLayerNode::validate() -{ - return Status{}; -} - -NodeType ConvolutionLayerNode::type() const -{ - return NodeType::ConvolutionLayer; -} - -void ConvolutionLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/DepthConcatenateLayerNode.cpp b/src/graph2/nodes/DepthConcatenateLayerNode.cpp deleted file mode 100644 index dcd66517b6..0000000000 --- a/src/graph2/nodes/DepthConcatenateLayerNode.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/DepthConcatenateLayerNode.h" - -#include "arm_compute/core/Utils.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -DepthConcatenateLayerNode::DepthConcatenateLayerNode(unsigned int total_nodes) - : _total_nodes(total_nodes), _is_enabled(true) -{ - _input_edges.resize(total_nodes, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -void DepthConcatenateLayerNode::set_enabled(bool is_enabled) -{ - _is_enabled = is_enabled; -} - -bool DepthConcatenateLayerNode::is_enabled() const -{ - return _is_enabled; -} - -TensorShape DepthConcatenateLayerNode::compute_output_shape(const std::vector<TensorShape> &input_shapes) -{ - ARM_COMPUTE_ERROR_ON(input_shapes.size() == 0); - - TensorShape output_shape = input_shapes[0]; - - size_t max_x = 0; - size_t max_y = 0; - size_t depth = 0; - - for(const auto &shape : input_shapes) - { - max_x = std::max(shape.x(), max_x); - max_y = std::max(shape.y(), max_y); - depth += shape.z(); - } - - output_shape.set(0, max_x); - output_shape.set(1, max_y); - output_shape.set(2, depth); - - return output_shape; -} - -bool DepthConcatenateLayerNode::forward_descriptors() -{ - if(_outputs[0] != NullTensorID) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor DepthConcatenateLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - ARM_COMPUTE_ERROR_ON(idx >= _outputs.size()); - - // Check if all input tensors are set - bool are_all_inputs_set = std::all_of(std::begin(_input_edges), std::end(_input_edges), [](const EdgeID & eid) - { - return eid != EmptyEdgeID; - }); - - TensorDescriptor output_info = {}; - - if(are_all_inputs_set) - { - std::vector<TensorShape> inputs_shapes; - for(unsigned int i = 0; i < _input_edges.size(); ++i) - { - const Tensor *t = _graph->tensor(input_id(i)); - ARM_COMPUTE_ERROR_ON(t == nullptr); - inputs_shapes.push_back(t->desc().shape); - } - output_info = input(0)->desc(); - TensorShape output_shape = compute_output_shape(inputs_shapes); - output_info.shape = output_shape; - } - - return output_info; -} - -Status DepthConcatenateLayerNode::validate() -{ - ARM_COMPUTE_UNUSED(_total_nodes); - return Status{}; -} - -NodeType DepthConcatenateLayerNode::type() const -{ - return NodeType::DepthConcatenateLayer; -} - -void DepthConcatenateLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/DepthwiseConvolutionLayerNode.cpp b/src/graph2/nodes/DepthwiseConvolutionLayerNode.cpp deleted file mode 100644 index b030e8b7ca..0000000000 --- a/src/graph2/nodes/DepthwiseConvolutionLayerNode.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/DepthwiseConvolutionLayerNode.h" - -#include "arm_compute/core/Utils.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -DepthwiseConvolutionLayerNode::DepthwiseConvolutionLayerNode(PadStrideInfo info, DepthwiseConvolutionMethod method) - : _info(std::move(info)), _method(method) -{ - _input_edges.resize(3, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -void DepthwiseConvolutionLayerNode::set_depthwise_convolution_method(DepthwiseConvolutionMethod method) -{ - _method = method; -} - -DepthwiseConvolutionMethod DepthwiseConvolutionLayerNode::depthwise_convolution_method() const -{ - return _method; -} - -PadStrideInfo DepthwiseConvolutionLayerNode::convolution_info() const -{ - return _info; -} - -TensorShape DepthwiseConvolutionLayerNode::compute_output_shape(TensorShape input_shape, TensorShape weights_shape, PadStrideInfo info) -{ - unsigned int output_width = 0; - unsigned int output_height = 0; - std::tie(output_width, output_height) = scaled_dimensions(input_shape.x(), input_shape.y(), weights_shape.x(), weights_shape.y(), info); - - TensorShape output_shape{ input_shape }; - output_shape.set(0, output_width); - output_shape.set(1, output_height); - - return output_shape; -} - -bool DepthwiseConvolutionLayerNode::forward_descriptors() -{ - if((input_id(0) != NullTensorID) && (input_id(1) != NullTensorID) && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor DepthwiseConvolutionLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - const Tensor *src = input(0); - const Tensor *weights = input(1); - - ARM_COMPUTE_ERROR_ON(src == nullptr || weights == nullptr); - - TensorDescriptor output_info = src->desc(); - TensorShape output_shape = compute_output_shape(src->desc().shape, weights->desc().shape, _info); - output_info.shape = output_shape; - return output_info; -} - -Status DepthwiseConvolutionLayerNode::validate() -{ - return Status{}; -} - -NodeType DepthwiseConvolutionLayerNode::type() const -{ - return NodeType::DepthwiseConvolutionLayer; -} - -void DepthwiseConvolutionLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/EltwiseLayerNode.cpp b/src/graph2/nodes/EltwiseLayerNode.cpp deleted file mode 100644 index 149d926d29..0000000000 --- a/src/graph2/nodes/EltwiseLayerNode.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/EltwiseLayerNode.h" - -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -EltwiseLayerNode::EltwiseLayerNode(EltwiseOperation op) - : _op(op) -{ - _input_edges.resize(2, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -EltwiseOperation EltwiseLayerNode::eltwise_operation() const -{ - return _op; -} - -bool EltwiseLayerNode::forward_descriptors() -{ - if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor EltwiseLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - ARM_COMPUTE_UNUSED(_op); - - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); - - return src->desc(); -} - -Status EltwiseLayerNode::validate() -{ - return Status{}; -} - -NodeType EltwiseLayerNode::type() const -{ - return NodeType::EltwiseLayer; -} - -void EltwiseLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute diff --git a/src/graph2/nodes/FlattenLayerNode.cpp b/src/graph2/nodes/FlattenLayerNode.cpp deleted file mode 100644 index 7c4059f3ed..0000000000 --- a/src/graph2/nodes/FlattenLayerNode.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/FlattenLayerNode.h" - -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -FlattenLayerNode::FlattenLayerNode() -{ - _input_edges.resize(1, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -bool FlattenLayerNode::forward_descriptors() -{ - if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor FlattenLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - ARM_COMPUTE_ERROR_ON(idx >= _outputs.size()); - - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); - - TensorDescriptor output_desc = src->desc(); - output_desc.shape.collapse(src->desc().shape.num_dimensions()); - - return output_desc; -} - -Status FlattenLayerNode::validate() -{ - return Status{}; -} - -NodeType FlattenLayerNode::type() const -{ - return NodeType::FlattenLayer; -} - -void FlattenLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/FullyConnectedLayer.cpp b/src/graph2/nodes/FullyConnectedLayer.cpp deleted file mode 100644 index 195adc40fe..0000000000 --- a/src/graph2/nodes/FullyConnectedLayer.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/FullyConnectedLayerNode.h" - -#include "arm_compute/core/Utils.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -FullyConnectedLayerNode::FullyConnectedLayerNode(unsigned int num_outputs) - : _num_outputs(num_outputs) -{ - _input_edges.resize(3, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -TensorShape FullyConnectedLayerNode::compute_weights_shape(TensorShape input_shape, unsigned int num_outputs) -{ - unsigned int num_weights = 1; - unsigned int num_dimensions = input_shape.num_dimensions(); - // Ignore the batch dimension if there is one: - if(num_dimensions == 2 || num_dimensions == 4) - { - num_dimensions--; - } - for(unsigned int i = 0; i < num_dimensions; i++) - { - num_weights *= input_shape[i]; - } - return TensorShape(num_weights, num_outputs); -} - -TensorShape FullyConnectedLayerNode::compute_output_shape(TensorShape input_shape, unsigned int num_outputs) -{ - // Note: Only 1D batch space is supported at the moment - unsigned int batches = input_shape[1]; - if(input_shape.num_dimensions() > 2) - { - batches = input_shape[3]; - } - return TensorShape(num_outputs, batches); -} - -bool FullyConnectedLayerNode::forward_descriptors() -{ - if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor FullyConnectedLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); - - TensorDescriptor output_info = src->desc(); - TensorShape output_shape = compute_output_shape(src->desc().shape, _num_outputs); - output_info.shape = output_shape; - return output_info; -} - -Status FullyConnectedLayerNode::validate() -{ - return Status{}; -} - -NodeType FullyConnectedLayerNode::type() const -{ - return NodeType::FullyConnectedLayer; -} - -void FullyConnectedLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/InputNode.cpp b/src/graph2/nodes/InputNode.cpp deleted file mode 100644 index 84cce2acdb..0000000000 --- a/src/graph2/nodes/InputNode.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/InputNode.h" - -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -InputNode::InputNode(TensorDescriptor desc) - : _desc(desc) -{ - _outputs.resize(1, NullTensorID); -} - -bool InputNode::forward_descriptors() -{ - if(output_id(0) != NullTensorID) - { - Tensor *t = output(0); - ARM_COMPUTE_ERROR_ON(t == nullptr); - t->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor InputNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - return _desc; -} - -Status InputNode::validate() -{ - return Status{}; -} - -NodeType InputNode::type() const -{ - return NodeType::Input; -} - -void InputNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute diff --git a/src/graph2/nodes/NormalizationLayerNode.cpp b/src/graph2/nodes/NormalizationLayerNode.cpp deleted file mode 100644 index a394879a3e..0000000000 --- a/src/graph2/nodes/NormalizationLayerNode.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/NormalizationLayerNode.h" - -#include "arm_compute/core/Utils.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -NormalizationLayerNode::NormalizationLayerNode(NormalizationLayerInfo norm_info) - : _info(norm_info) -{ - _input_edges.resize(1, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -NormalizationLayerInfo NormalizationLayerNode::normalization_info() const -{ - return _info; -} - -bool NormalizationLayerNode::forward_descriptors() -{ - if(input_id(0) != NullTensorID && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor NormalizationLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - ARM_COMPUTE_ERROR_ON(idx >= _outputs.size()); - - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); - - return src->desc(); -} - -Status NormalizationLayerNode::validate() -{ - return Status{}; -} - -NodeType NormalizationLayerNode::type() const -{ - return NodeType::NormalizationLayer; -} - -void NormalizationLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/OutputNode.cpp b/src/graph2/nodes/OutputNode.cpp deleted file mode 100644 index 1daebb1cc8..0000000000 --- a/src/graph2/nodes/OutputNode.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/OutputNode.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" -#include "arm_compute/graph2/Tensor.h" - -namespace arm_compute -{ -namespace graph2 -{ -OutputNode::OutputNode() -{ - _input_edges.resize(1, EmptyEdgeID); -} - -bool OutputNode::forward_descriptors() -{ - return true; -} - -TensorDescriptor OutputNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - return TensorDescriptor(); -} - -Status OutputNode::validate() -{ - return Status{}; -} - -NodeType OutputNode::type() const -{ - return NodeType::Output; -} - -void OutputNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute diff --git a/src/graph2/nodes/PoolingLayerNode.cpp b/src/graph2/nodes/PoolingLayerNode.cpp deleted file mode 100644 index 2c2cf5387a..0000000000 --- a/src/graph2/nodes/PoolingLayerNode.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/PoolingLayerNode.h" - -#include "arm_compute/core/Utils.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -PoolingLayerNode::PoolingLayerNode(PoolingLayerInfo pool_info) - : _info(std::move(pool_info)) -{ - _input_edges.resize(1, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -PoolingLayerInfo PoolingLayerNode::pooling_info() const -{ - return _info; -} - -TensorShape PoolingLayerNode::compute_output_shape(TensorShape input_shape, PoolingLayerInfo info) -{ - const int pool_size_x = info.is_global_pooling() ? input_shape.x() : info.pool_size().width; - const int pool_size_y = info.is_global_pooling() ? input_shape.y() : info.pool_size().height; - - unsigned int pooled_width = 0; - unsigned int pooled_height = 0; - std::tie(pooled_width, pooled_height) = scaled_dimensions(input_shape.x(), input_shape.y(), pool_size_x, pool_size_y, info.pad_stride_info()); - - TensorShape output_shape{ input_shape }; - output_shape.set(0, pooled_width); - output_shape.set(1, pooled_height); - - return output_shape; -} - -bool PoolingLayerNode::forward_descriptors() -{ - if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor PoolingLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - ARM_COMPUTE_ERROR_ON(idx >= _outputs.size()); - - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); - - TensorDescriptor output_info = src->desc(); - TensorShape output_shape = compute_output_shape(src->desc().shape, _info); - output_info.shape = output_shape; - return output_info; -} - -Status PoolingLayerNode::validate() -{ - return Status{}; -} - -NodeType PoolingLayerNode::type() const -{ - return NodeType::PoolingLayer; -} - -void PoolingLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/ReshapeLayer.cpp b/src/graph2/nodes/ReshapeLayer.cpp deleted file mode 100644 index 6280eea75c..0000000000 --- a/src/graph2/nodes/ReshapeLayer.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/ReshapeLayerNode.h" - -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -ReshapeLayerNode::ReshapeLayerNode(TensorShape shape) - : _shape(shape) -{ - _input_edges.resize(1, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -bool ReshapeLayerNode::forward_descriptors() -{ - if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor ReshapeLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - ARM_COMPUTE_ERROR_ON(idx >= _outputs.size()); - - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); - - TensorDescriptor output_desc = src->desc(); - output_desc.shape = _shape; - - return output_desc; -} - -Status ReshapeLayerNode::validate() -{ - return Status{}; -} - -NodeType ReshapeLayerNode::type() const -{ - return NodeType::ReshapeLayer; -} - -void ReshapeLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/SoftmaxLayerNode.cpp b/src/graph2/nodes/SoftmaxLayerNode.cpp deleted file mode 100644 index 83bc978981..0000000000 --- a/src/graph2/nodes/SoftmaxLayerNode.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/SoftmaxLayerNode.h" - -#include "arm_compute/core/Utils.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -SoftmaxLayerNode::SoftmaxLayerNode(float beta) - : _beta(beta) -{ - _input_edges.resize(1, EmptyEdgeID); - _outputs.resize(1, NullTensorID); -} - -float SoftmaxLayerNode::beta() const -{ - return _beta; -} - -bool SoftmaxLayerNode::forward_descriptors() -{ - if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID)) - { - Tensor *dst = output(0); - ARM_COMPUTE_ERROR_ON(dst == nullptr); - dst->desc() = configure_output(0); - return true; - } - return false; -} - -TensorDescriptor SoftmaxLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - ARM_COMPUTE_ERROR_ON(idx >= _outputs.size()); - - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); - - return src->desc(); -} - -Status SoftmaxLayerNode::validate() -{ - return Status{}; -} - -NodeType SoftmaxLayerNode::type() const -{ - return NodeType::SoftmaxLayer; -} - -void SoftmaxLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file diff --git a/src/graph2/nodes/SplitLayerNode.cpp b/src/graph2/nodes/SplitLayerNode.cpp deleted file mode 100644 index c34a7ff176..0000000000 --- a/src/graph2/nodes/SplitLayerNode.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/graph2/nodes/SplitLayerNode.h" - -#include "arm_compute/core/Utils.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/INodeVisitor.h" - -namespace arm_compute -{ -namespace graph2 -{ -SplitLayerNode::SplitLayerNode(unsigned int num_splits, unsigned int axis) - : _num_splits(num_splits), _axis(axis) -{ - _input_edges.resize(1, EmptyEdgeID); - _outputs.resize(num_splits, NullTensorID); -} - -unsigned int SplitLayerNode::num_splits() const -{ - return _num_splits; -} - -unsigned int SplitLayerNode::axis() const -{ - return _axis; -} - -std::pair<TensorShape, Coordinates> SplitLayerNode::compute_output_shape(TensorShape input_shape, unsigned int num_splits, unsigned int axis, unsigned int idx) -{ - ARM_COMPUTE_ERROR_ON(axis >= input_shape.num_dimensions()); - ARM_COMPUTE_ERROR_ON_MSG(input_shape[axis] % num_splits, "Split should be exact"); - - const unsigned int split_size = input_shape[axis] / num_splits; - - TensorShape output_shape = input_shape; - output_shape.set(axis, split_size); - - Coordinates coords; - coords.set(axis, idx * split_size); - - return std::make_pair(output_shape, coords); -} - -bool SplitLayerNode::forward_descriptors() -{ - if(input_id(0) != NullTensorID) - { - for(unsigned int i = 0; i < _outputs.size(); ++i) - { - if(output_id(i) != NullTensorID) - { - Tensor *dst_i = output(i); - ARM_COMPUTE_ERROR_ON(dst_i == nullptr); - dst_i->desc() = configure_output(i); - } - } - return true; - } - return false; -} - -TensorDescriptor SplitLayerNode::configure_output(size_t idx) const -{ - ARM_COMPUTE_UNUSED(idx); - ARM_COMPUTE_ERROR_ON(idx >= _outputs.size()); - - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); - - TensorShape output_shape; - - TensorDescriptor output_info = src->desc(); - std::tie(output_shape, std::ignore) = compute_output_shape(src->desc().shape, _num_splits, _axis, idx); - output_info.shape = output_shape; - - return output_info; -} - -Status SplitLayerNode::validate() -{ - return Status{}; -} - -NodeType SplitLayerNode::type() const -{ - return NodeType::SplitLayer; -} - -void SplitLayerNode::accept(INodeVisitor &v) -{ - v.visit(*this); -} -} // namespace graph2 -} // namespace arm_compute
\ No newline at end of file |