ArmNN  NotReleased
LstmTestImpl.cpp File Reference

Go to the source code of this file.

Functions

LayerTestResult< float, 2 > LstmLayerFloat32WithCifgWithPeepholeNoProjectionTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 2 > LstmLayerFloat32NoCifgWithPeepholeWithProjectionTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 2 > LstmLayerFloat32NoCifgNoPeepholeNoProjectionTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 2 > LstmLayerFloat32NoCifgWithPeepholeWithProjectionWithLayerNormTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 2 > LstmLayerInt16NoCifgNoPeepholeNoProjectionTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 2 > LstmLayerInt16WithCifgWithPeepholeNoProjectionTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 2 > LstmLayerInt16NoCifgWithPeepholeWithProjectionTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 2 > LstmLayerInt16NoCifgNoPeepholeNoProjectionInt16ConstantTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 2 > QuantizedLstmTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 

Function Documentation

◆ LstmLayerFloat32NoCifgNoPeepholeNoProjectionTest()

LayerTestResult<float, 2> LstmLayerFloat32NoCifgNoPeepholeNoProjectionTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 1926 of file LstmTestImpl.cpp.

References armnn::Float32.

Referenced by BOOST_AUTO_TEST_CASE().

1929 {
1930  armnn::TensorInfo inputDesc({2, 2}, armnn::DataType::Float32);
1931  boost::multi_array<float, 2> input = MakeTensor<float, 2>(inputDesc, std::vector<float>(
1932  {2., 3., 3., 4.}));
1933 
1934  armnn::TensorInfo outputDesc({2, 4}, armnn::DataType::Float32);
1935  boost::multi_array<float, 2> expectedOutput = MakeTensor<float, 2>(outputDesc, std::vector<float>(
1936  {{-0.02973187f, 0.1229473f, 0.20885126f, -0.15358765f,
1937  -0.0185422f, 0.11281417f, 0.24466537f, -0.1826292f}}));
1938 
1939  return LstmNoCifgNoPeepholeNoProjectionTestImpl<armnn::DataType::Float32>(
1940  workloadFactory, memoryManager, input, expectedOutput);
1941 }

◆ LstmLayerFloat32NoCifgWithPeepholeWithProjectionTest()

LayerTestResult<float, 2> LstmLayerFloat32NoCifgWithPeepholeWithProjectionTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 1904 of file LstmTestImpl.cpp.

References armnn::Float32.

Referenced by BOOST_AUTO_TEST_CASE().

1907 {
1908  armnn::TensorInfo inputDesc({ 2, 5 }, armnn::DataType::Float32);
1909  boost::multi_array<float, 2> input = MakeTensor<float, 2>(inputDesc, std::vector<float>(
1910  {0.787926f, 0.151646f, 0.071352f, 0.118426f, 0.458058f,
1911  0.295743f, 0.544053f, 0.690064f, 0.858138f, 0.497181f}));
1912 
1913  armnn::TensorInfo outputDesc({ 2, 16 }, armnn::DataType::Float32);
1914  boost::multi_array<float, 2> expectedOutput = MakeTensor<float, 2>(outputDesc, std::vector<float>(
1915  {-0.00396806f, 0.029352f, -0.00279226f, 0.0159977f, -0.00835576f,
1916  -0.0211779f, 0.0283512f, -0.0114597f, 0.00907307f, -0.0244004f,
1917  -0.0152191f, -0.0259063f, 0.00914318f, 0.00415118f, 0.017147f,
1918  0.0134203f, -0.013869f, 0.0287268f, -0.00334693f, 0.00733398f, -0.0287926f,
1919  -0.0186926f, 0.0193662f, -0.0115437f, 0.00422612f, -0.0345232f,
1920  0.00223253f, -0.00957321f, 0.0210624f, 0.013331f, 0.0150954f,
1921  0.02168f}));
1922  return LstmLayerNoCifgWithPeepholeWithProjectionTestImpl<armnn::DataType::Float32>(
1923  workloadFactory, memoryManager, input, expectedOutput);
1924 }

◆ LstmLayerFloat32NoCifgWithPeepholeWithProjectionWithLayerNormTest()

LayerTestResult<float, 2> LstmLayerFloat32NoCifgWithPeepholeWithProjectionWithLayerNormTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 1943 of file LstmTestImpl.cpp.

References armnn::Float32.

Referenced by BOOST_AUTO_TEST_CASE().

1946 {
1947  armnn::TensorInfo inputDesc({ 2, 5 }, armnn::DataType::Float32);
1948  boost::multi_array<float, 2> input = MakeTensor<float, 2>(inputDesc, std::vector<float>(
1949  {0.7f, 0.8f, 0.1f, 0.2f, 0.3f, //batch 0
1950  0.3f, 0.2f, 0.9f, 0.8f, 0.1f})); //batch 1
1951 
1952  armnn::TensorInfo outputDesc({ 2, 3 }, armnn::DataType::Float32);
1953  boost::multi_array<float, 2> expectedOutput = MakeTensor<float, 2>(outputDesc, std::vector<float>(
1954  { 0.0244077f, 0.128027f, -0.00170918f, //batch 0
1955  -0.00692428f, 0.0848741f, 0.063445f})); //batch 1
1956  return LstmLayerNoCifgWithPeepholeWithProjectionWithLayerNormTestImpl<armnn::DataType::Float32>(
1957  workloadFactory, memoryManager, input, expectedOutput);
1958 }

◆ LstmLayerFloat32WithCifgWithPeepholeNoProjectionTest()

LayerTestResult<float, 2> LstmLayerFloat32WithCifgWithPeepholeNoProjectionTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 1888 of file LstmTestImpl.cpp.

References armnn::Float32.

Referenced by BOOST_AUTO_TEST_CASE().

1891 {
1892  armnn::TensorInfo inputDesc({ 2, 2 }, armnn::DataType::Float32);
1893  boost::multi_array<float, 2> input = MakeTensor<float, 2>(inputDesc, std::vector<float>(
1894  { 2., 3., 3., 4. }));
1895 
1896  armnn::TensorInfo outputDesc({ 2, 4 }, armnn::DataType::Float32);
1897  boost::multi_array<float, 2> expectedOutput = MakeTensor<float, 2>(outputDesc, std::vector<float>(
1898  {-0.36444446f, -0.00352185f, 0.12886585f, -0.05163646f,
1899  -0.42734814f, -0.00478661f, 0.13455015f, -0.03560682f}));
1900  return LstmLayerWithCifgWithPeepholeNoProjectionTestImpl<armnn::DataType::Float32>(
1901  workloadFactory, memoryManager, input, expectedOutput);
1902 }

◆ LstmLayerInt16NoCifgNoPeepholeNoProjectionInt16ConstantTest()

LayerTestResult<int16_t, 2> LstmLayerInt16NoCifgNoPeepholeNoProjectionInt16ConstantTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 2063 of file LstmTestImpl.cpp.

References armnn::QSymmS16.

Referenced by BOOST_AUTO_TEST_CASE().

2066 {
2067  const float qScale = 1.0f;
2068  const int32_t qOffset = 0;
2069 
2070  const armnn::DataType datatype = armnn::DataType::QSymmS16; // datatype & constants set to QSymm16
2071 
2072  armnn::TensorInfo inputDesc({2, 2}, datatype);
2073  boost::multi_array<int16_t , 2> input =
2074  MakeTensor<int16_t , 2>(inputDesc,
2075  armnnUtils::QuantizedVector<int16_t>({ 2.f, 3.f, 3.f, 4.f }, qScale, qOffset));
2076 
2077  armnn::TensorInfo outputDesc({2, 4}, datatype);
2078  boost::multi_array<int16_t, 2> expectedOutput =
2079  MakeTensor<int16_t, 2>(
2080  outputDesc,
2081  armnnUtils::QuantizedVector<int16_t>(
2082  {
2083  -0.02973187f, 0.12294730f, 0.20885126f, -0.15358765f,
2084  -0.01854220f, 0.11281417f, 0.24466537f, -0.18262920f
2085  },
2086  qScale, qOffset));
2087 
2088  return LstmNoCifgNoPeepholeNoProjectionTestImpl<datatype>(
2089  workloadFactory, memoryManager, input, expectedOutput, qScale, qOffset, datatype);
2090 }
DataType
Definition: Types.hpp:32

◆ LstmLayerInt16NoCifgNoPeepholeNoProjectionTest()

LayerTestResult<int16_t, 2> LstmLayerInt16NoCifgNoPeepholeNoProjectionTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 1960 of file LstmTestImpl.cpp.

References armnn::QAsymmU8, and armnn::QSymmS16.

Referenced by BOOST_AUTO_TEST_CASE().

1963 {
1964  const float qScale = 1.0f;
1965  const int32_t qOffset = 0;
1966 
1967  const armnn::DataType datatype = armnn::DataType::QSymmS16;
1968  const armnn::DataType constantDatatype = armnn::DataType::QAsymmU8;
1969 
1970  armnn::TensorInfo inputDesc({2, 2}, datatype);
1971  boost::multi_array<int16_t , 2> input = MakeTensor<int16_t , 2>(
1972  inputDesc,
1973  armnnUtils::QuantizedVector<int16_t>({ 2.f, 3.f, 3.f, 4.f }, qScale, qOffset));
1974 
1975  armnn::TensorInfo outputDesc({2, 4}, datatype);
1976  boost::multi_array<int16_t, 2> expectedOutput = MakeTensor<int16_t, 2>(
1977  outputDesc,
1978  armnnUtils::QuantizedVector<int16_t>(
1979  {
1980  -0.02973187f, 0.12294730f, 0.20885126f, -0.15358765f,
1981  -0.01854220f, 0.11281417f, 0.24466537f, -0.18262920f
1982  },
1983  qScale, qOffset));
1984 
1985  return LstmNoCifgNoPeepholeNoProjectionTestImpl<datatype>(
1986  workloadFactory, memoryManager, input, expectedOutput, qScale, qOffset, constantDatatype);
1987 
1988 }
DataType
Definition: Types.hpp:32

◆ LstmLayerInt16NoCifgWithPeepholeWithProjectionTest()

LayerTestResult<int16_t, 2> LstmLayerInt16NoCifgWithPeepholeWithProjectionTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 2021 of file LstmTestImpl.cpp.

References armnn::QAsymmU8, and armnn::QSymmS16.

Referenced by BOOST_AUTO_TEST_CASE().

2024 {
2025  const float qScale = 2.0f;
2026  const int32_t qOffset = 0;
2027 
2028  const armnn::DataType datatype = armnn::DataType::QSymmS16;
2029  const armnn::DataType constantDatatype = armnn::DataType::QAsymmU8;
2030 
2031  armnn::TensorInfo inputDesc({ 2, 5 }, datatype);
2032  boost::multi_array<int16_t, 2> input =
2033  MakeTensor<int16_t, 2>(
2034  inputDesc,
2035  armnnUtils::QuantizedVector<int16_t>(
2036  {
2037  0.787926f, 0.151646f, 0.071352f, 0.118426f, 0.458058f,
2038  0.295743f, 0.544053f, 0.690064f, 0.858138f, 0.497181f
2039  },
2040  qScale, qOffset));
2041 
2042  armnn::TensorInfo outputDesc({ 2, 16 }, datatype);
2043  boost::multi_array<int16_t, 2> expectedOutput =
2044  MakeTensor<int16_t, 2>(
2045  outputDesc,
2046  armnnUtils::QuantizedVector<int16_t>(
2047  {
2048  -0.00396806f, 0.02935200f, -0.00279226f, 0.01599770f,
2049  -0.00835576f, -0.02117790f, 0.02835120f, -0.01145970f,
2050  0.00907307f, -0.02440040f, -0.01521910f, -0.02590630f,
2051  0.00914318f, 0.00415118f, 0.01714700f, 0.01342030f,
2052  -0.01386900f, 0.02872680f, -0.00334693f, 0.00733398f,
2053  -0.02879260f, -0.01869260f, 0.01936620f, -0.01154370f,
2054  0.00422612f, -0.03452320f, 0.00223253f, -0.00957321f,
2055  0.02106240f, 0.01333100f, 0.01509540f, 0.02168000f
2056  },
2057  qScale, qOffset));
2058 
2059  return LstmLayerNoCifgWithPeepholeWithProjectionTestImpl<datatype>(
2060  workloadFactory, memoryManager, input, expectedOutput, qScale, qOffset, constantDatatype);
2061 }
DataType
Definition: Types.hpp:32

◆ LstmLayerInt16WithCifgWithPeepholeNoProjectionTest()

LayerTestResult<int16_t, 2> LstmLayerInt16WithCifgWithPeepholeNoProjectionTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 1990 of file LstmTestImpl.cpp.

References armnn::QAsymmU8, and armnn::QSymmS16.

Referenced by BOOST_AUTO_TEST_CASE().

1993 {
1994  const float qScale = 1.0f;
1995  const int32_t qOffset = 0;
1996 
1997  const armnn::DataType datatype = armnn::DataType::QSymmS16;
1998  const armnn::DataType constantDatatype = armnn::DataType::QAsymmU8;
1999 
2000  armnn::TensorInfo inputDesc({ 2, 2 }, datatype);
2001  boost::multi_array<int16_t, 2> input =
2002  MakeTensor<int16_t, 2>(
2003  inputDesc,
2004  armnnUtils::QuantizedVector<int16_t>({ 2.f, 3.f, 3.f, 4.f }, qScale, qOffset));
2005 
2006  armnn::TensorInfo outputDesc({ 2, 4 }, datatype);
2007  boost::multi_array<int16_t, 2> expectedOutput =
2008  MakeTensor<int16_t, 2>(
2009  outputDesc,
2010  armnnUtils::QuantizedVector<int16_t>(
2011  {
2012  -0.36444446f, -0.00352185f, 0.12886585f, -0.05163646f,
2013  -0.42734814f, -0.00478661f, 0.13455015f, -0.03560682f
2014  },
2015  qScale, qOffset));
2016 
2017  return LstmLayerWithCifgWithPeepholeNoProjectionTestImpl<datatype>(
2018  workloadFactory, memoryManager, input, expectedOutput, qScale, qOffset, constantDatatype);
2019 }
DataType
Definition: Types.hpp:32

◆ QuantizedLstmTest()

LayerTestResult<uint8_t, 2> QuantizedLstmTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 2096 of file LstmTestImpl.cpp.

References armnn::QAsymmU8.

2099 {
2100  armnn::TensorInfo inputDesc({2, 2}, armnn::DataType::QAsymmU8);
2101  boost::multi_array<uint8_t, 2> input = MakeTensor<uint8_t, 2>(inputDesc, std::vector<uint8_t>(
2102  {166, 179, 50, 150}));
2103 
2104  armnn::TensorInfo outputDesc({2, 4}, armnn::DataType::QAsymmU8);
2105  boost::multi_array<uint8_t, 2> expectedOutput = MakeTensor<uint8_t, 2>(outputDesc, std::vector<uint8_t>(
2106  {140, 151, 146, 112, 136, 156, 142, 112 }));
2107 
2108  return QuantizedLstmTestImpl(workloadFactory, memoryManager, input, expectedOutput);
2109 }