| 30 | } |
| 31 | |
| 32 | void 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 | |
| 63 | void SwitchLayer::ExecuteStrategy(IStrategy& strategy) const |
| 64 | { |
nothing calls this directly
no test coverage detected