MCPcopy Create free account
hub / github.com/ARM-software/armnn / ValidateTensorShapesFromInputs

Method ValidateTensorShapesFromInputs

src/armnn/layers/SwitchLayer.cpp:32–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void SwitchLayer::ValidateTensorShapesFromInputs()
33{
34 VerifyLayerConnections(2, CHECK_LOCATION());
35
36 const TensorShape& outputShape = GetOutputSlot(0).GetTensorInfo().GetShape();
37
38 VerifyShapeInferenceType(outputShape, m_ShapeInferenceMethod);
39
40 if (GetNumOutputSlots() != 2)
41 {
42 throw armnn::LayerValidationException("SwitchLayer: The layer should return 2 outputs.");
43 }
44
45 // Assuming first input is the Input and second input is the Constant
46 std::vector<TensorShape> inferredShapes = InferOutputShapes({
47 GetInputSlot(0).GetTensorInfo().GetShape(),
48 GetInputSlot(1).GetTensorInfo().GetShape()});
49
50 if (inferredShapes.size() != 2)
51 {
52 throw armnn::LayerValidationException("inferredShapes has "
53 + std::to_string(inferredShapes.size()) +
54 " element(s) - should only have 2.");
55 }
56
57 ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "SwitchLayer");
58
59 ValidateAndCopyShape(
60 GetOutputSlot(1).GetTensorInfo().GetShape(), inferredShapes[1], m_ShapeInferenceMethod, "SwitchLayer", 1);
61}
62
63void SwitchLayer::ExecuteStrategy(IStrategy& strategy) const
64{

Callers

nothing calls this directly

Calls 4

to_stringFunction · 0.50
GetShapeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected