ArmNN
 21.02
ExpandDims.cpp File Reference
#include <boost/test/unit_test.hpp>
#include "armnnTfParser/ITfParser.hpp"
#include "ParserPrototxtFixture.hpp"

Go to the source code of this file.

Functions

 BOOST_FIXTURE_TEST_CASE (ParseExpandZeroDim, ExpandZeroDim)
 
 BOOST_FIXTURE_TEST_CASE (ParseExpandTwoDim, ExpandTwoDim)
 
 BOOST_FIXTURE_TEST_CASE (ParseExpandThreeDim, ExpandThreeDim)
 
 BOOST_FIXTURE_TEST_CASE (ParseExpandMinusOneDim, ExpandMinusOneDim)
 
 BOOST_FIXTURE_TEST_CASE (ParseExpandMinusThreeDim, ExpandMinusThreeDim)
 
 BOOST_FIXTURE_TEST_CASE (ParseExpandDimAsInput, ExpandDimAsInput)
 
 BOOST_FIXTURE_TEST_CASE (ParseExpandDimAsInputWrongDataType, ExpandDimAsInputWrongDataType)
 
 BOOST_FIXTURE_TEST_CASE (ParseExpandDimAsInputWrongShape, ExpandDimAsInputWrongShape)
 
 BOOST_FIXTURE_TEST_CASE (ParseExpandDimAsNotConstInput, ExpandDimsAsNotConstInputFixture)
 

Function Documentation

◆ BOOST_FIXTURE_TEST_CASE() [1/9]

BOOST_FIXTURE_TEST_CASE ( ParseExpandZeroDim  ,
ExpandZeroDim   
)

Definition at line 82 of file ExpandDims.cpp.

83 {
84  BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo("ExpandDims").second.GetShape() ==
85  armnn::TensorShape({1, 2, 3, 5})));
86 }

◆ BOOST_FIXTURE_TEST_CASE() [2/9]

BOOST_FIXTURE_TEST_CASE ( ParseExpandTwoDim  ,
ExpandTwoDim   
)

Definition at line 88 of file ExpandDims.cpp.

89 {
90  BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo("ExpandDims").second.GetShape() ==
91  armnn::TensorShape({2, 3, 1, 5})));
92 }

◆ BOOST_FIXTURE_TEST_CASE() [3/9]

BOOST_FIXTURE_TEST_CASE ( ParseExpandThreeDim  ,
ExpandThreeDim   
)

Definition at line 94 of file ExpandDims.cpp.

95 {
96  BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo("ExpandDims").second.GetShape() ==
97  armnn::TensorShape({2, 3, 5, 1})));
98 }

◆ BOOST_FIXTURE_TEST_CASE() [4/9]

BOOST_FIXTURE_TEST_CASE ( ParseExpandMinusOneDim  ,
ExpandMinusOneDim   
)

Definition at line 100 of file ExpandDims.cpp.

101 {
102  BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo("ExpandDims").second.GetShape() ==
103  armnn::TensorShape({2, 3, 5, 1})));
104 }

◆ BOOST_FIXTURE_TEST_CASE() [5/9]

BOOST_FIXTURE_TEST_CASE ( ParseExpandMinusThreeDim  ,
ExpandMinusThreeDim   
)

Definition at line 106 of file ExpandDims.cpp.

107 {
108  BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo("ExpandDims").second.GetShape() ==
109  armnn::TensorShape({2, 1, 3, 5})));
110 }

◆ BOOST_FIXTURE_TEST_CASE() [6/9]

BOOST_FIXTURE_TEST_CASE ( ParseExpandDimAsInput  ,
ExpandDimAsInput   
)

Definition at line 202 of file ExpandDims.cpp.

203 {
204  // Axis parameter that describes which axis/dim should be expanded is passed as a second input
205  BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo("ExpandDims").second.GetShape() ==
206  armnn::TensorShape({1, 1, 4})));
207 }

◆ BOOST_FIXTURE_TEST_CASE() [7/9]

BOOST_FIXTURE_TEST_CASE ( ParseExpandDimAsInputWrongDataType  ,
ExpandDimAsInputWrongDataType   
)

Definition at line 214 of file ExpandDims.cpp.

215 {
216  // Axis parameter that describes which axis/dim should be expanded is passed as a second input
217  // Axis parameter is of wrong data type (float instead of int32)
218  BOOST_REQUIRE_THROW(Setup({{"a", {1,4}} ,{"b",{1,1}}}, { "ExpandDims" }), armnn::ParseException);
219 }

◆ BOOST_FIXTURE_TEST_CASE() [8/9]

BOOST_FIXTURE_TEST_CASE ( ParseExpandDimAsInputWrongShape  ,
ExpandDimAsInputWrongShape   
)

Definition at line 226 of file ExpandDims.cpp.

227 {
228  // Axis parameter that describes which axis/dim should be expanded is passed as a second input
229  // Axis parameter is of wrong shape
230  BOOST_REQUIRE_THROW(Setup({{"a", {1,4}} ,{"b",{1,1}}}, { "ExpandDims" }), armnn::ParseException);
231 }

◆ BOOST_FIXTURE_TEST_CASE() [9/9]

BOOST_FIXTURE_TEST_CASE ( ParseExpandDimAsNotConstInput  ,
ExpandDimsAsNotConstInputFixture   
)

Definition at line 305 of file ExpandDims.cpp.

References BOOST_AUTO_TEST_SUITE_END().

306 {
307  // Axis parameter that describes which axis/dim should be expanded is passed as a second input.
308  // But is not a constant tensor --> not supported
309  BOOST_REQUIRE_THROW(Setup({{"a", {1,4}} ,{"b",{1,1}}}, { "ExpandDims" }),
311 }