25 const std::vector<TensorShape>& inputShapes =
33 unsigned int filterDepth = filterShape[0];
34 unsigned int filterHeight = filterShape[1];
35 unsigned int filterWidth = filterShape[2];
36 unsigned int inChannels = filterShape[3];
37 unsigned int outChannels = filterShape[4];
39 fn(
"FilterDepth",std::to_string(filterDepth));
40 fn(
"FilterHeight",std::to_string(filterHeight));
41 fn(
"FilterWidth",std::to_string(filterWidth));
42 fn(
"InputChannels",std::to_string(inChannels));
43 fn(
"OutputChannels",std::to_string(outChannels));
58 auto layer = CloneBase<Convolution3dLayer>(graph,
m_Param,
GetName());
59 return std::move(layer);
68 ARMNN_ASSERT_MSG(inputShape.GetNumDimensions() == 5,
"Convolutions will always have 5D input.");
76 unsigned int inWidth = inputShape[dataLayoutIndex.
GetWidthIndex()];
77 unsigned int inHeight = inputShape[dataLayoutIndex.
GetHeightIndex()];
78 unsigned int inDepth = inputShape[dataLayoutIndex.
GetDepthIndex()];
79 unsigned int inBatchSize = inputShape[0];
82 unsigned int filterDepth = filterShape[0];
83 unsigned int dilatedFilterDepth = filterDepth + (
m_Param.
m_DilationZ - 1) * (filterDepth - 1);
87 unsigned int filterHeight = filterShape[1];
88 unsigned int dilatedFilterHeight = filterHeight + (
m_Param.
m_DilationY - 1) * (filterHeight - 1);
92 unsigned int filterWidth = filterShape[2];
93 unsigned int dilatedFilterWidth = filterWidth + (
m_Param.
m_DilationX - 1) * (filterWidth - 1);
97 unsigned int outChannels = filterShape[4];
98 unsigned int outBatchSize = inBatchSize;
101 TensorShape( { outBatchSize, outDepth, outHeight, outWidth, outChannels } ) :
102 TensorShape( { outBatchSize, outChannels, outDepth, outHeight, outWidth });
104 return std::vector<TensorShape>({ tensorShape });
116 "Convolution3dLayer: Weights should be connected to input slot 1.");
131 throw armnn::Exception(
"Convolution3dLayer: VisitConvolution3dLayer is not implemented");
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the Convolution3d type.
Convolution3dDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
const Convolution3dDescriptor & GetParameters() const
unsigned int GetWidthIndex() const
const TensorShape & GetShape() const
uint32_t m_PadBack
Padding back value in the depth dimension.
#define ARMNN_NO_DEPRECATE_WARN_BEGIN
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
virtual void ExecuteStrategy(const armnn::IConnectableLayer *layer, const armnn::BaseDescriptor &descriptor, const std::vector< armnn::ConstTensor > &constants, const char *name, const armnn::LayerBindingId id=0)=0
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
By default returns inputShapes if the number of inputs are equal to number of outputs, otherwise infers the output shapes from given input shapes and layer properties.
void SerializeLayerParameters(ParameterStringifyFunction &fn) const override
Helper to serialize the layer parameters to string (currently used in DotSerializer and company)...
uint32_t m_PadBottom
Padding bottom value in the height dimension.
unsigned int GetDepthIndex() const
void VerifyShapeInferenceType(const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
Copyright (c) 2021 ARM Limited and Contributors.
void IgnoreUnused(Ts &&...)
uint32_t m_DilationX
Dilation along x axis.
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
unsigned int GetHeightIndex() const
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
ARMNN_NO_DEPRECATE_WARN_END void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
void SerializeLayerParameters(ParameterStringifyFunction &fn) const override
Helper to serialize the layer parameters to string.
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
ARMNN_NO_DEPRECATE_WARN_BEGIN void Accept(ILayerVisitor &visitor) const override
#define ARMNN_NO_DEPRECATE_WARN_END
#define ARMNN_ASSERT_MSG(COND, MSG)
Provides access to the appropriate indexes for Channels, Height and Width based on DataLayout...
Convolution3dLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
#define ARMNN_ASSERT(COND)
uint32_t m_PadFront
Padding front value in the depth dimension.
uint32_t m_PadLeft
Padding left value in the width dimension.
A Convolution3dDescriptor for the Convolution3dLayer.
uint32_t m_PadRight
Padding right value in the width dimension.
virtual std::unique_ptr< IWorkload > CreateConvolution3d(const Convolution3dQueueDescriptor &descriptor, const WorkloadInfo &info) const
void SetAdditionalInfo(QueueDescriptor &descriptor) const
DataLayout m_DataLayout
The data layout to be used (NDHWC, NCDHW).
Convolution3dLayer(const Convolution3dDescriptor ¶m, const char *name)
Constructor to create a Convolution3dLayer.
Base class for all ArmNN exceptions so that users can filter to just those.
uint32_t m_PadTop
Padding top value in the height dimension.
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of Convolution3dLayer.
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
virtual const TensorInfo & GetTensorInfo() const =0
uint32_t GetNumInputs() const
Get the number of views/inputs.
const char * GetName() const override
Returns the name of the layer.
This layer represents a convolution 3d operation.
std::function< void(const std::string &name, const std::string &value)> ParameterStringifyFunction
const TensorInfo & GetTensorInfo() const override
uint32_t m_DilationZ
Dilation along z axis.
uint32_t m_StrideZ
Stride value when proceeding through input for the depth dimension.
ShapeInferenceMethod m_ShapeInferenceMethod
uint32_t m_DilationY
Dilation along y axis.
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...