: m_ReduceFp32ToFp16(false)
, m_Debug(false)
, m_ReduceFp32ToBf16(false)
+ , m_shapeInferenceMethod(armnn::ShapeInferenceMethod::ValidateOnly)
{}
- OptimizerOptions(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16 = false)
+ OptimizerOptions(bool reduceFp32ToFp16, bool debug, bool reduceFp32ToBf16 = false,
+ ShapeInferenceMethod shapeInferenceMethod = armnn::ShapeInferenceMethod::ValidateOnly)
: m_ReduceFp32ToFp16(reduceFp32ToFp16)
, m_Debug(debug)
, m_ReduceFp32ToBf16(reduceFp32ToBf16)
+ , m_shapeInferenceMethod(shapeInferenceMethod)
{
if (m_ReduceFp32ToFp16 && m_ReduceFp32ToBf16)
{
// Reduce Fp32 data to Bf16 for faster processing
bool m_ReduceFp32ToBf16;
+
+ // Infer output size when not available
+ ShapeInferenceMethod m_shapeInferenceMethod;
};
/// Create an optimized version of the network
Ceiling = 1
};
+///
+/// The ShapeInferenceMethod modify how the output shapes are treated.
+/// When ValidateOnly is selected, the output shapes are inferred from the input parameters of the layer
+/// and any mismatch is reported.
+/// When InferAndValidate is selected 2 actions must be performed: (1)infer output shape from inputs and (2)validate the
+/// shapes as in ValidateOnly. This option has been added to work with tensors which rank or dimension sizes are not
+/// specified explicitly, however this information can be calculated from the inputs.
+///
+enum class ShapeInferenceMethod
+{
+ /// Validate all output shapes
+ ValidateOnly = 0,
+ /// Infer missing output shapes and validate all output shapes
+ InferAndValidate = 1
+};
+
/// Each backend should implement an IBackend.
class IBackend
{
subgraph.Clear();
}
-void Graph::InferTensorInfos()
+void Graph::InferTensorInfos(ShapeInferenceMethod shapeInferenceMethod)
{
for (auto&& layer : TopologicalSort())
{
throw LayerValidationException("All inputs must have the TensorInfo set at this point.");
}
}
- layer->ValidateTensorShapesFromInputs();
+ layer->ValidateTensorShapesFromInputs(shapeInferenceMethod);
}
}
void SubstituteSubgraph(SubgraphView& subgraph, IConnectableLayer* substituteLayer);
void SubstituteSubgraph(SubgraphView& subgraph, const SubgraphView& substituteSubgraph);
- void InferTensorInfos();
+ void InferTensorInfos(ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly);
void AttachObservable(IGraphObservable* const observable, GraphEvent notifyOnEvent) {
m_Views[notifyOnEvent].emplace_back(observable);
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation& location) const;
- virtual void ValidateTensorShapesFromInputs() = 0;
+ virtual void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) = 0;
std::vector<TensorShape> InferOutputShapes(const std::vector<TensorShape>& inputShapes) const override;
return CloneBase<AbsLayer>(graph, GetName());
}
-void AbsLayer::ValidateTensorShapesFromInputs()
+void AbsLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref AbsLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<ActivationLayer>(graph, m_Param, GetName());
}
-void ActivationLayer::ValidateTensorShapesFromInputs()
+void ActivationLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
ActivationLayer* Clone(Graph& graph) const override;
/// Check if the input tensor shape(s) will lead to a valid configuration of @ref ActivationLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape>({ outputShape });
}
-void ArgMinMaxLayer::ValidateTensorShapesFromInputs()
+void ArgMinMaxLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref ArgMinMaxLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::move(layer);
}
-void BatchNormalizationLayer::ValidateTensorShapesFromInputs()
+void BatchNormalizationLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref BatchNormalizationLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::move(layer);
}
-void BatchToSpaceNdLayer::ValidateTensorShapesFromInputs()
+void BatchToSpaceNdLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape()});
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref BatchToSpaceNdLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return std::vector<TensorShape>({ TensorShape(numDims, dims.data()) });
}
-void ComparisonLayer::ValidateTensorShapesFromInputs()
+void ComparisonLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(2, CHECK_LOCATION());
std::vector<TensorShape> inferredShapes = InferOutputShapes({
/// Check if the input tensor shape(s) will lead to a valid configuration
/// of @ref ComparisonLayer
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape>({ TensorShape({numDims, extentMax.data()}) });
}
-void ConcatLayer::ValidateTensorShapesFromInputs()
+void ConcatLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
// Validates Concat layer.
ConditionalThrowIfNotEqual<LayerValidationException>(
"ConcatLayer: Num Inputs must match num views.",
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref ConcatLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return std::vector<TensorShape>({ inputShapes[0] });
}
-void ConstantLayer::ValidateTensorShapesFromInputs()
+void ConstantLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
// Get the output shape from the value of the constant layer.
TensorShape const& outShape = m_LayerOutput->GetTensorInfo().GetShape();
ConditionalThrowIfNotEqual<LayerValidationException>(
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref ConstantLayer
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return CloneBase<ConvertBf16ToFp32Layer>(graph, GetName());
}
-void ConvertBf16ToFp32Layer::ValidateTensorShapesFromInputs()
+void ConvertBf16ToFp32Layer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref ConvertBf16ToFp32Layer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<ConvertFp16ToFp32Layer>(graph, GetName());
}
-void ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs()
+void ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref ConvertFp16ToFp32Layer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<ConvertFp32ToBf16Layer>(graph, GetName());
}
-void ConvertFp32ToBf16Layer::ValidateTensorShapesFromInputs()
+void ConvertFp32ToBf16Layer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref ConvertFp32ToBf16Layer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<ConvertFp32ToFp16Layer>(graph, GetName());
}
-void ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs()
+void ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref ConvertFp32ToFp16Layer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape>({ tensorShape });
}
-void Convolution2dLayer::ValidateTensorShapesFromInputs()
+void Convolution2dLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
// check if we m_Weight data is not nullptr
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref Convolution2dLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return CloneBase<DebugLayer>(graph, GetName());
}
-void DebugLayer::ValidateTensorShapesFromInputs()
+void DebugLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
std::vector<TensorShape> inferredShapes = InferOutputShapes({
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref DebugLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape>({ outputShape });
}
-void DepthToSpaceLayer::ValidateTensorShapesFromInputs()
+void DepthToSpaceLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
std::vector<TensorShape> inferredShapes = InferOutputShapes({
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref DepthToSpaceLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape>{ tensorShape };
}
-void DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs()
+void DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
// on this level constant data should not be released..
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref DepthwiseConvolution2dLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return CloneBase<DequantizeLayer>(graph, GetName());
}
-void DequantizeLayer::ValidateTensorShapesFromInputs()
+void DequantizeLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
std::vector<TensorShape> inferredShapes = InferOutputShapes({
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref DequantizeLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::move(layer);
}
-void DetectionPostProcessLayer::ValidateTensorShapesFromInputs()
+void DetectionPostProcessLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(2, CHECK_LOCATION());
// on this level constant data should not be released.
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref DetectionPostProcessLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape>({ TensorShape(numDims, dims.data()) });
}
-void ElementwiseBaseLayer::ValidateTensorShapesFromInputs()
+void ElementwiseBaseLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(2, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({
public:
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of the element wise operation.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return std::vector<TensorShape>({ input });
}
-void ElementwiseUnaryLayer::ValidateTensorShapesFromInputs()
+void ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
std::vector<TensorShape> inferredShapes = InferOutputShapes({
/// Check if the input tensor shape(s) will lead to a valid configuration
/// of @ref ElementwiseUnaryLayer
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<FakeQuantizationLayer>(graph, m_Param, GetName());
}
-void FakeQuantizationLayer::ValidateTensorShapesFromInputs()
+void FakeQuantizationLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref FakeQuantizationLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validate.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<FillLayer>(graph, m_Param, GetName());
}
-void FillLayer::ValidateTensorShapesFromInputs()
+void FillLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes( { GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref FillLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validate.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<FloorLayer>(graph, GetName());
}
-void FloorLayer::ValidateTensorShapesFromInputs()
+void FloorLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref FloorLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validate.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape>({ TensorShape({batches, weightShape[dimIdx]})});
}
-void FullyConnectedLayer::ValidateTensorShapesFromInputs()
+void FullyConnectedLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
// check if we m_Weight data is not nullptr
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref FullyConnectedLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validate.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return CloneBase<GatherLayer>(graph, GetName());
}
-void GatherLayer::ValidateTensorShapesFromInputs()
+void GatherLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(2, CHECK_LOCATION());
const TensorInfo& params = GetInputSlot(0).GetConnection()->GetTensorInfo();
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref GatherLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validate.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<InputLayer>(graph, GetBindingId(), GetName());
}
-void InputLayer::ValidateTensorShapesFromInputs()
+void InputLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
//The input layer should already have it's inputs set during graph building phase in the driver/parser.
ConditionalThrow<LayerValidationException>(GetOutputSlot(0).IsTensorInfoSet(),
"InputLayer should already have the TensorInfo set.");
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref InputLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validate.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<InstanceNormalizationLayer>(graph, m_Param, GetName());
}
-void InstanceNormalizationLayer::ValidateTensorShapesFromInputs()
+void InstanceNormalizationLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref InstanceNormalizationLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validate.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<L2NormalizationLayer>(graph, m_Param, GetName());
}
-void L2NormalizationLayer::ValidateTensorShapesFromInputs()
+void L2NormalizationLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref L2NormalizationLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<LogSoftmaxLayer>(graph, m_Param, GetName());
}
-void LogSoftmaxLayer::ValidateTensorShapesFromInputs()
+void LogSoftmaxLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref LogSoftmaxLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return outShapes;
}
-void LstmLayer::ValidateTensorShapesFromInputs()
+void LstmLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(3, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes( {
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref LstmLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return std::move(layer);
}
-void MeanLayer::ValidateTensorShapesFromInputs()
+void MeanLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
const TensorInfo& input = GetInputSlot(0).GetConnection()->GetTensorInfo();
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref MeanLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::make_unique<CopyMemGenericWorkload>(descriptor, PrepInfoAndDesc(descriptor));
}
-void MemCopyLayer::ValidateTensorShapesFromInputs()
+void MemCopyLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref MemCopyLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::make_unique<ImportMemGenericWorkload>(descriptor, PrepInfoAndDesc(descriptor));
}
-void MemImportLayer::ValidateTensorShapesFromInputs()
+void MemImportLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref MemImportLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<MergeLayer>(graph, GetName());
}
-void MergeLayer::ValidateTensorShapesFromInputs()
+void MergeLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(2, CHECK_LOCATION());
std::vector<TensorShape> inferredShapes = InferOutputShapes({
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref MergeLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
/// Infers the output shapes from given input shapes.
/// @param [in] inputShapes The input shapes layer has.
return CloneBase<NormalizationLayer>(graph, m_Param, GetName());
}
-void NormalizationLayer::ValidateTensorShapesFromInputs()
+void NormalizationLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref NormalizationLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<OutputLayer>(graph, GetBindingId(), GetName());
}
-void OutputLayer::ValidateTensorShapesFromInputs()
+void OutputLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
// Just validates that the input is connected.
ConditionalThrow<LayerValidationException>(GetInputSlot(0).GetConnection() != nullptr,
"OutputLayer: Input slot must be connected.");
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref OutputLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::move(layer);
}
-void PadLayer::ValidateTensorShapesFromInputs()
+void PadLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
return;
}
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref PadLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape> ({armnnUtils::Permuted(inShape, m_Param.m_DimMappings)});
}
-void PermuteLayer::ValidateTensorShapesFromInputs()
+void PermuteLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref PermuteLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return std::vector<TensorShape>({ tensorShape });
}
-void Pooling2dLayer::ValidateTensorShapesFromInputs()
+void Pooling2dLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref Pooling2dLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return factory.CreatePreCompiled(descriptor, PrepInfoAndDesc(descriptor));
}
-void PreCompiledLayer::ValidateTensorShapesFromInputs()
+void PreCompiledLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
// NOTE: since the PreCompiledLayer is an internal layer created from a valid SubgraphView,
// we do not need to validate its input shapes
}
PreCompiledLayer* Clone(Graph &graph) const override;
- void ValidateTensorShapesFromInputs() override;
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void SetPreCompiledObject(PreCompiledObjectPtr preCompiledObject);
return { outputShape };
}
-void PreluLayer::ValidateTensorShapesFromInputs()
+void PreluLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(2, CHECK_LOCATION());
std::vector<TensorShape> inferredShapes = InferOutputShapes(
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref PreluLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return outShapes;
}
-void QLstmLayer::ValidateTensorShapesFromInputs()
+void QLstmLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(3, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes(
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref QLstmLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return clone;
}
-void QuantizeLayer::ValidateTensorShapesFromInputs()
+void QuantizeLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
Layer* Clone(Graph& graph) const override;
- void ValidateTensorShapesFromInputs() override;
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return outShapes;
}
-void QuantizedLstmLayer::ValidateTensorShapesFromInputs()
+void QuantizedLstmLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(3, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes(
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref QuantizedLstmLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return std::vector<TensorShape>({ m_Param.m_TargetShape });
}
-void ReshapeLayer::ValidateTensorShapesFromInputs()
+void ReshapeLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref ReshapeLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return std::vector<TensorShape>({ tensorShape });
}
-void ResizeLayer::ValidateTensorShapesFromInputs()
+void ResizeLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref ResizeLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return CloneBase<RsqrtLayer>(graph, GetName());
}
-void RsqrtLayer::ValidateTensorShapesFromInputs()
+void RsqrtLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref RsqrtLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<SliceLayer>(graph, m_Param, GetName());
}
-void SliceLayer::ValidateTensorShapesFromInputs()
+void SliceLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref SliceLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return CloneBase<SoftmaxLayer>(graph, m_Param, GetName());
}
-void SoftmaxLayer::ValidateTensorShapesFromInputs()
+void SoftmaxLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref SoftmaxLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape>({ outputShape });
}
-void SpaceToBatchNdLayer::ValidateTensorShapesFromInputs()
+void SpaceToBatchNdLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
std::vector<TensorShape> inferredShapes = InferOutputShapes({
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref SpaceToBatchNdLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape>({ outputShape });
}
-void SpaceToDepthLayer::ValidateTensorShapesFromInputs()
+void SpaceToDepthLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
std::vector<TensorShape> inferredShapes = InferOutputShapes({
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref SpaceToDepthLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return outShapes;
}
-void SplitterLayer::ValidateTensorShapesFromInputs()
+void SplitterLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
std::vector<TensorShape> views;
for (unsigned int viewIdx = 0; viewIdx < m_Param.GetNumViews(); viewIdx++)
{
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref SplitterLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
return std::vector<TensorShape>({ targetShape });
}
-void StackLayer::ValidateTensorShapesFromInputs()
+void StackLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
// Validates Stack layer.
ConditionalThrowIfNotEqual<LayerValidationException>(
"StackLayer: Num Input Slots must match Num Inputs.",
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref StackLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) 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.
throw Exception("Stand in layer does not support infering output shapes");
}
-void StandInLayer::ValidateTensorShapesFromInputs()
+void StandInLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
// Cannot validate this layer since no implementation details can be known by the framework
// so do nothing here.
}
/// Check if the input tensor shape(s)
/// Does nothing since cannot validate any properties of this layer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
/// Empty implementation that throws Exception if called.
/// otherwise infers the output shapes from given input shapes and layer properties.
TensorShape(boost::numeric_cast<unsigned int>(outputShape.size()), &outputShape[0]) });
}
-void StridedSliceLayer::ValidateTensorShapesFromInputs()
+void StridedSliceLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape()});
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref StridedSliceLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return CloneBase<SwitchLayer>(graph, GetName());
}
-void SwitchLayer::ValidateTensorShapesFromInputs()
+void SwitchLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(2, CHECK_LOCATION());
ARMNN_ASSERT_MSG(GetNumOutputSlots() == 2, "SwitchLayer: The layer should return 2 outputs.");
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref SwitchLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
void Accept(ILayerVisitor& visitor) const override;
return std::vector<TensorShape>({ tensorShape });
}
-void TransposeConvolution2dLayer::ValidateTensorShapesFromInputs()
+void TransposeConvolution2dLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
ARMNN_ASSERT_MSG(m_Weight != nullptr, "TransposeConvolution2dLayer: Weight data cannot be null.");
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref TransposeConvolution2dLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
/// Infers the output shapes from given input shapes and layer properties.
/// @param [in] inputShapes The input shapes the layer has.
return std::vector<TensorShape> ({armnnUtils::TransposeTensorShape(inShape, m_Param.m_DimMappings)});
}
-void TransposeLayer::ValidateTensorShapesFromInputs()
+void TransposeLayer::ValidateTensorShapesFromInputs(ShapeInferenceMethod shapeInferenceMethod)
{
+ IgnoreUnused(shapeInferenceMethod);
+
VerifyLayerConnections(1, CHECK_LOCATION());
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref TransposeLayer.
- void ValidateTensorShapesFromInputs() override;
+ /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
+ void ValidateTensorShapesFromInputs(
+ ShapeInferenceMethod shapeInferenceMethod = ShapeInferenceMethod::ValidateOnly) override;
/// Infers the output shapes from given input shapes and the permutation vector.
/// @param [in] inputShapes The input shapes layer has.