From b8cc2b9257640a560fb3e9627a2654acf32dbf8d Mon Sep 17 00:00:00 2001 From: Cathal Corbett Date: Fri, 8 Oct 2021 14:43:11 +0100 Subject: IVGCVSW-6416 AddFullyConnected API crashes without connected weights/bias layers * Created method in Graph.cpp/hpp ConstructErrorMessageForUnconnectedInputs() to verify weights and bias are set for FullyConnected layers. * Above method called in Graph.cpp InferTensorInfos() to print a more descriptive message when the weights or bias for a FullyConnectedLayer is not set. * Added try-catch in TestUtils.cpp Connect() to ensure input slot is available when connecting two layers. This ensures we catch the case where bias is is not enabled and we try and set a bias layer. * Added unit tests to check for LayerValidationError when weights or bias is not set on a FullyConnectedLayer. * Added unit test to check for LayerValidationError when bias is not enabled and we try and connect bias to FullyConnected Layer. * Seperated FullyConnected EndToEnd unit test method into two methods. First, performs tests on EndToEnd examples asserting output value. Second, performs tests on error catching. * Added comments to created methods. Signed-off-by: Cathal Corbett Change-Id: I5207d8c5ebacfff598556742ccd4f53eef7dee0c --- src/backends/reference/test/RefEndToEndTests.cpp | 26 +++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/backends/reference') diff --git a/src/backends/reference/test/RefEndToEndTests.cpp b/src/backends/reference/test/RefEndToEndTests.cpp index 6c11a75e96..0cc8f4aa10 100644 --- a/src/backends/reference/test/RefEndToEndTests.cpp +++ b/src/backends/reference/test/RefEndToEndTests.cpp @@ -618,17 +618,37 @@ TEST_CASE("RefFullyConnectedEndToEndTestFloat32") TEST_CASE("RefFullyConnectedEndToEndTestNonConstantWeightsConstantBiasesFloat32") { - FullyConnectedWithDynamicOrConstantInputsEndToEnd(defaultBackends, true, true, true); + FullyConnectedWithDynamicOrConstantInputsEndToEnd(defaultBackends, true, true); } TEST_CASE("RefFullyConnectedEndToEndTestConstantWeightsNonConstantBiasesFloat32") { - FullyConnectedWithDynamicOrConstantInputsEndToEnd(defaultBackends, true, false, true); + FullyConnectedWithDynamicOrConstantInputsEndToEnd(defaultBackends, true, false); } TEST_CASE("RefFullyConnectedEndToEndTestConstantWeightsTensorInfoNotSet") { - FullyConnectedWithDynamicOrConstantInputsEndToEnd(defaultBackends, true, false, false); + FullyConnectedErrorChecking(defaultBackends, false, true, true, true, false); +} + +TEST_CASE("RefFullyConnectedEndToEndTestWeightsNotConnectedExplicitCheck") +{ + FullyConnectedErrorChecking(defaultBackends, true, true, false, true, true); +} + +TEST_CASE("RefFullyConnectedEndToEndTestBiasNotConnectedExplicitCheck") +{ + FullyConnectedErrorChecking(defaultBackends, true, true, true, false, true); +} + +TEST_CASE("RefFullyConnectedEndToEndTestWeightsAndBiasNotConnected") +{ + FullyConnectedErrorChecking(defaultBackends, false, true, false, false, true); +} + +TEST_CASE("RefFullyConnectedEndToEndTestBiasDisabledConnectBias") +{ + FullyConnectedErrorChecking(defaultBackends, true, false, false, true, true); } TEST_CASE("RefGatherFloatTest") -- cgit v1.2.1