// // Copyright © 2017 Arm Ltd. All rights reserved. // SPDX-License-Identifier: MIT // #include "ReshapeLayer.hpp" #include "LayerCloneBase.hpp" #include #include #include #include namespace armnn { ReshapeLayer::ReshapeLayer(const ReshapeDescriptor& param, const char* name) : LayerWithParameters(1, 1, LayerType::Reshape, param, name) { } std::unique_ptr ReshapeLayer::CreateWorkload(const IWorkloadFactory& factory) const { ReshapeQueueDescriptor descriptor; return factory.CreateReshape(descriptor, PrepInfoAndDesc(descriptor)); } ReshapeLayer* ReshapeLayer::Clone(Graph& graph) const { return CloneBase(graph, m_Param, GetName()); } std::vector ReshapeLayer::InferOutputShapes(const std::vector& inputShapes) const { IgnoreUnused(inputShapes); return std::vector({ m_Param.m_TargetShape }); } void ReshapeLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod) { IgnoreUnused(shapeInferenceMethod); VerifyLayerConnections(1, CHECK_LOCATION()); auto inferredShapes = InferOutputShapes({ }); ARMNN_ASSERT(inferredShapes.size() == 1); ConditionalThrowIfNotEqual( "ReshapeLayer: TensorShape set on OutputSlot[0] does not match the inferred shape.", GetOutputSlot(0).GetTensorInfo().GetShape(), inferredShapes[0]); } void ReshapeLayer::Accept(ILayerVisitor& visitor) const { visitor.VisitReshapeLayer(this, GetParameters(), GetName()); } } // namespace armnn