src/armnn/layers/DebugLayer.cpp \
src/armnn/layers/DepthwiseConvolution2dLayer.cpp \
src/armnn/layers/ElementwiseBaseLayer.cpp \
+ src/armnn/layers/EqualLayer.cpp \
src/armnn/layers/FakeQuantizationLayer.cpp \
src/armnn/layers/FloorLayer.cpp \
src/armnn/layers/FullyConnectedLayer.cpp \
src/armnn/layers/DepthwiseConvolution2dLayer.cpp
src/armnn/layers/ElementwiseBaseLayer.hpp
src/armnn/layers/ElementwiseBaseLayer.cpp
+ src/armnn/layers/EqualLayer.hpp
+ src/armnn/layers/EqualLayer.cpp
src/armnn/layers/FakeQuantizationLayer.hpp
src/armnn/layers/FakeQuantizationLayer.cpp
src/armnn/layers/FloorLayer.hpp
const TensorInfo& output,
Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const;
+ virtual bool IsEqualSupported(const TensorInfo& input0,
+ const TensorInfo& input1,
+ const TensorInfo& output,
+ Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const;
+
virtual bool IsFakeQuantizationSupported(const TensorInfo& input,
const FakeQuantizationDescriptor& descriptor,
Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const;
/// @ return - Interface for configuring the layer.
virtual IConnectableLayer* AddGreaterLayer(const char* name = nullptr) = 0;
+ /// Add a Equal layer to the network.
+ /// @param name - Optional name for the layer.
+ /// @ return - Interface for configuring the layer.
+ virtual IConnectableLayer* AddEqualLayer(const char* name = nullptr) = 0;
+
protected:
~INetwork() {}
};
char* reasonIfUnsupported = nullptr,
size_t reasonIfUnsupportedMaxLength = 1024);
+/// Deprecated in favor of IBackend and ILayerSupport interfaces
+bool IsEqualSupported(const BackendId& backend,
+ const TensorInfo& input0,
+ const TensorInfo& input1,
+ const TensorInfo& output,
+ char* reasonIfUnsupported = nullptr,
+ size_t reasonIfUnsupportedMaxLength = 1024);
}
case LayerType::Debug: return "Debug";
case LayerType::DepthwiseConvolution2d: return "DepthwiseConvolution2d";
case LayerType::Division: return "Division";
+ case LayerType::Equal: return "Equal";
case LayerType::FakeQuantization: return "FakeQuantization";
case LayerType::Floor: return "Floor";
case LayerType::FullyConnected: return "FullyConnected";
Debug,
DepthwiseConvolution2d,
Division,
+ Equal,
FakeQuantization,
Floor,
FullyConnected,
FORWARD_LAYER_SUPPORT_FUNC(backend, IsGreaterSupported, input0, input1, output);
}
+bool IsEqualSupported(const BackendId& backend,
+ const TensorInfo& input0,
+ const TensorInfo& input1,
+ const TensorInfo& output,
+ char* reasonIfUnsupported,
+ size_t reasonIfUnsupportedMaxLength)
+{
+ FORWARD_LAYER_SUPPORT_FUNC(backend, IsEqualSupported, input0, input1, output);
+}
+
}
#include "layers/DebugLayer.hpp"
#include "layers/DepthwiseConvolution2dLayer.hpp"
#include "layers/DivisionLayer.hpp"
+#include "layers/EqualLayer.hpp"
#include "layers/FakeQuantizationLayer.hpp"
#include "layers/FloorLayer.hpp"
#include "layers/FullyConnectedLayer.hpp"
DECLARE_LAYER(Debug)
DECLARE_LAYER(DepthwiseConvolution2d)
DECLARE_LAYER(Division)
+DECLARE_LAYER(Equal)
DECLARE_LAYER(FakeQuantization)
DECLARE_LAYER(Floor)
DECLARE_LAYER(FullyConnected)
return m_Graph->AddLayer<GreaterLayer>(name);
}
+IConnectableLayer* Network::AddEqualLayer(const char* name)
+{
+ return m_Graph->AddLayer<GreaterLayer>(name);
+}
+
OptimizedNetwork::OptimizedNetwork(std::unique_ptr<Graph> graph)
: m_Graph(std::move(graph))
{
IConnectableLayer* AddGreaterLayer(const char* name = nullptr) override;
+ IConnectableLayer* AddEqualLayer(const char* name = nullptr) override;
+
private:
IConnectableLayer* AddFullyConnectedLayerImpl(const FullyConnectedDescriptor& fullyConnectedDescriptor,
const ConstTensor& weights,
--- /dev/null
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "EqualLayer.hpp"
+
+#include "LayerCloneBase.hpp"
+
+#include <armnn/TypesUtils.hpp>
+#include <backendsCommon/WorkloadData.hpp>
+#include <backendsCommon/WorkloadFactory.hpp>
+
+namespace armnn
+{
+
+EqualLayer::EqualLayer(const char* name)
+ : ElementwiseBaseLayer(2, 1, LayerType::Equal, name)
+{
+}
+
+std::unique_ptr<IWorkload> EqualLayer::CreateWorkload(const Graph& graph,
+ const IWorkloadFactory& factory) const
+{
+ EqualQueueDescriptor descriptor;
+ return factory.CreateEqual(descriptor, PrepInfoAndDesc(descriptor, graph));
+}
+
+EqualLayer* EqualLayer::Clone(Graph& graph) const
+{
+ return CloneBase<EqualLayer>(graph, GetName());
+}
+
+} // namespace armnn
--- /dev/null
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include "ElementwiseBaseLayer.hpp"
+
+namespace armnn
+{
+
+class EqualLayer : public ElementwiseBaseLayer
+{
+public:
+ virtual std::unique_ptr<IWorkload> CreateWorkload(const Graph& graph,
+ const IWorkloadFactory& factory) const override;
+
+ EqualLayer* Clone(Graph& graph) const override;
+
+protected:
+ EqualLayer(const char* name);
+ ~EqualLayer() = default;
+};
+
+} //namespace armnn
return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported);
}
+bool ILayerSupport::IsEqualSupported(const armnn::TensorInfo& input0,
+ const armnn::TensorInfo& input1,
+ const armnn::TensorInfo& output,
+ armnn::Optional<std::string &> reasonIfUnsupported) const
+{
+ return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported);
+}
+
bool ILayerSupport::IsFakeQuantizationSupported(const TensorInfo& input,
const FakeQuantizationDescriptor& descriptor,
Optional<std::string&> reasonIfUnsupported) const
void Validate(const WorkloadInfo& workloadInfo) const;
};
+// Equal layer workload data
+struct EqualQueueDescriptor : QueueDescriptor
+{
+ void Validate(const WorkloadInfo& workloadInfo) const;
+};
+
// Batch norm layer workload data.
struct BatchNormalizationQueueDescriptor : QueueDescriptorWithParameters<BatchNormalizationDescriptor>
{
reason);
break;
}
+ case LayerType::Equal:
+ {
+ const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo();
+ const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo();
+ const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
+ result = layerSupportObject->IsEqualSupported(OverrideDataType(input0, dataType),
+ OverrideDataType(input1, dataType),
+ OverrideDataType(output, dataType),
+ reason);
+ break;
+ }
case LayerType::FakeQuantization:
{
auto cLayer = boost::polymorphic_downcast<const FakeQuantizationLayer*>(&layer);
virtual std::unique_ptr<IWorkload> CreatePad(const PadQueueDescriptor& descriptor,
const WorkloadInfo& Info) const = 0;
+ virtual std::unique_ptr<IWorkload> CreateEqual(const EqualQueueDescriptor& descriptor,
+ const WorkloadInfo& Info) const = 0;
+
virtual std::unique_ptr<IWorkload> CreateStridedSlice(const StridedSliceQueueDescriptor& descriptor,
const WorkloadInfo& Info) const = 0;
DECLARE_LAYER_POLICY_2_PARAM(DepthwiseConvolution2d)
+DECLARE_LAYER_POLICY_1_PARAM(Equal)
+
DECLARE_LAYER_POLICY_2_PARAM(FakeQuantization)
DECLARE_LAYER_POLICY_1_PARAM(Floor)
return MakeWorkload<ClPadWorkload>(descriptor, info);
}
+std::unique_ptr<IWorkload> ClWorkloadFactory::CreateEqual(const EqualQueueDescriptor& descriptor,
+ const WorkloadInfo& info) const
+{
+ return MakeWorkload<NullWorkload, NullWorkload>(descriptor, info);
+}
+
std::unique_ptr<IWorkload> ClWorkloadFactory::CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor,
const WorkloadInfo& info) const
{
virtual std::unique_ptr<IWorkload> CreatePad(const PadQueueDescriptor& descriptor,
const WorkloadInfo& info) const override;
+ virtual std::unique_ptr<IWorkload> CreateEqual(const EqualQueueDescriptor& descriptor,
+ const WorkloadInfo& info) const override;
+
virtual std::unique_ptr<IWorkload> CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor,
const WorkloadInfo& info) const override;
return MakeWorkloadHelper<NullWorkload, NullWorkload>(descriptor, info);
}
+std::unique_ptr<IWorkload> NeonWorkloadFactory::CreateEqual(const EqualQueueDescriptor& descriptor,
+ const WorkloadInfo& info) const
+{
+ return MakeWorkloadHelper<NullWorkload, NullWorkload>(descriptor, info);
+}
+
std::unique_ptr<IWorkload> NeonWorkloadFactory::CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor,
const WorkloadInfo& info) const
{
virtual std::unique_ptr<IWorkload> CreatePad(const PadQueueDescriptor& descriptor,
const WorkloadInfo& info) const override;
+ virtual std::unique_ptr<IWorkload> CreateEqual(const EqualQueueDescriptor& descriptor,
+ const WorkloadInfo& info) const override;
+
virtual std::unique_ptr<IWorkload> CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor,
const WorkloadInfo& Info) const override;
return MakeWorkload<RefPadFloat32Workload, RefPadUint8Workload>(descriptor, info);
}
+std::unique_ptr<IWorkload> RefWorkloadFactory::CreateEqual(const EqualQueueDescriptor& descriptor,
+ const WorkloadInfo& info) const
+{
+ return MakeWorkload<NullWorkload, NullWorkload>(descriptor, info);
+}
+
std::unique_ptr<IWorkload> RefWorkloadFactory::CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor,
const WorkloadInfo& info) const
{
virtual std::unique_ptr<IWorkload> CreatePad(const PadQueueDescriptor& descriptor,
const WorkloadInfo& info) const override;
+ virtual std::unique_ptr<IWorkload> CreateEqual(const EqualQueueDescriptor& descriptor,
+ const WorkloadInfo& info) const override;
+
virtual std::unique_ptr<IWorkload> CreateBatchToSpaceNd(const BatchToSpaceNdQueueDescriptor& descriptor,
const WorkloadInfo& info) const override;