aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/layers
diff options
context:
space:
mode:
authorjimfly01 <jim.flynn@arm.com>2019-02-05 09:20:11 +0000
committerJim Flynn <jim.flynn@arm.com>2019-02-07 16:00:12 +0000
commitaebf2e7871997378d33fa99f7cab6322be9b726f (patch)
treeaef3f6fd05aafbee10100de85ec2e766d4f92ef7 /src/armnn/layers
parent857aa45407df9dbe99a11d03a4be2b20bd0110ae (diff)
downloadarmnn-aebf2e7871997378d33fa99f7cab6322be9b726f.tar.gz
IVGCVSW-2553 Add Unit Test for ConstTensor layer visitors
Change-Id: I20a67135e4af7aa1f28f5000d73122f4e5e3acd5 Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src/armnn/layers')
-rw-r--r--src/armnn/layers/BatchNormalizationLayer.cpp3
-rw-r--r--src/armnn/layers/ConstantLayer.cpp2
-rw-r--r--src/armnn/layers/Convolution2dLayer.cpp4
-rw-r--r--src/armnn/layers/DepthwiseConvolution2dLayer.cpp4
-rw-r--r--src/armnn/layers/FullyConnectedLayer.cpp4
-rw-r--r--src/armnn/layers/LstmLayer.cpp34
6 files changed, 26 insertions, 25 deletions
diff --git a/src/armnn/layers/BatchNormalizationLayer.cpp b/src/armnn/layers/BatchNormalizationLayer.cpp
index 2212f47d3c..725dbd88b2 100644
--- a/src/armnn/layers/BatchNormalizationLayer.cpp
+++ b/src/armnn/layers/BatchNormalizationLayer.cpp
@@ -75,7 +75,8 @@ void BatchNormalizationLayer::Accept(ILayerVisitor& visitor) const
ConstTensor varianceTensor(m_Variance->GetTensorInfo(), m_Variance->Map(true));
ConstTensor betaTensor(m_Beta->GetTensorInfo(), m_Beta->Map(true));
ConstTensor gammaTensor(m_Gamma->GetTensorInfo(), m_Gamma->Map(true));
- visitor.VisitBatchNormalizationLayer(this, GetParameters(), meanTensor, varianceTensor, betaTensor, gammaTensor);
+ visitor.VisitBatchNormalizationLayer(
+ this, GetParameters(), meanTensor, varianceTensor, betaTensor, gammaTensor, GetName());
}
} // namespace armnn
diff --git a/src/armnn/layers/ConstantLayer.cpp b/src/armnn/layers/ConstantLayer.cpp
index 919fd61087..31e1549e0e 100644
--- a/src/armnn/layers/ConstantLayer.cpp
+++ b/src/armnn/layers/ConstantLayer.cpp
@@ -53,7 +53,7 @@ void ConstantLayer::ValidateTensorShapesFromInputs()
void ConstantLayer::Accept(ILayerVisitor& visitor) const
{
- ConstTensor layerOutputTensor(m_LayerOutput->GetTensorInfo(), m_LayerOutput->GetTensor<void*>()) ;
+ ConstTensor layerOutputTensor(m_LayerOutput->GetTensorInfo(), m_LayerOutput->Map(true)) ;
visitor.VisitConstantLayer(this, layerOutputTensor, GetName());
}
diff --git a/src/armnn/layers/Convolution2dLayer.cpp b/src/armnn/layers/Convolution2dLayer.cpp
index cb90f81e23..2c0997a9d0 100644
--- a/src/armnn/layers/Convolution2dLayer.cpp
+++ b/src/armnn/layers/Convolution2dLayer.cpp
@@ -112,10 +112,10 @@ Layer::ConstantTensors Convolution2dLayer::GetConstantTensorsByRef()
void Convolution2dLayer::Accept(ILayerVisitor& visitor) const
{
- ConstTensor weightsTensor(m_Weight->GetTensorInfo(), m_Weight->GetTensor<void*>()) ;
- ConstTensor biasTensor(m_Bias->GetTensorInfo(), m_Bias->GetConstTensor<void*>());
+ ConstTensor weightsTensor(m_Weight->GetTensorInfo(), m_Weight->Map(true)) ;
if (GetParameters().m_BiasEnabled)
{
+ ConstTensor biasTensor(m_Bias->GetTensorInfo(), m_Bias->Map(true));
visitor.VisitConvolution2dLayer(this, GetParameters(), weightsTensor, biasTensor, GetName());
}
else
diff --git a/src/armnn/layers/DepthwiseConvolution2dLayer.cpp b/src/armnn/layers/DepthwiseConvolution2dLayer.cpp
index dca13f263c..a17673fc1e 100644
--- a/src/armnn/layers/DepthwiseConvolution2dLayer.cpp
+++ b/src/armnn/layers/DepthwiseConvolution2dLayer.cpp
@@ -122,10 +122,10 @@ Layer::ConstantTensors DepthwiseConvolution2dLayer::GetConstantTensorsByRef()
void DepthwiseConvolution2dLayer::Accept(ILayerVisitor& visitor) const
{
- ConstTensor weightsTensor(m_Weight->GetTensorInfo(), m_Weight->GetTensor<void*>()) ;
- ConstTensor biasTensor(m_Bias->GetTensorInfo(), m_Bias->GetConstTensor<void*>());
+ ConstTensor weightsTensor(m_Weight->GetTensorInfo(), m_Weight->Map(true)) ;
if (GetParameters().m_BiasEnabled)
{
+ ConstTensor biasTensor(m_Bias->GetTensorInfo(), m_Bias->Map(true));
visitor.VisitDepthwiseConvolution2dLayer(this, GetParameters(), weightsTensor, biasTensor, GetName());
}
else
diff --git a/src/armnn/layers/FullyConnectedLayer.cpp b/src/armnn/layers/FullyConnectedLayer.cpp
index 783482e013..219113bca6 100644
--- a/src/armnn/layers/FullyConnectedLayer.cpp
+++ b/src/armnn/layers/FullyConnectedLayer.cpp
@@ -88,10 +88,10 @@ Layer::ConstantTensors FullyConnectedLayer::GetConstantTensorsByRef()
void FullyConnectedLayer::Accept(ILayerVisitor& visitor) const
{
- ConstTensor weightsTensor(m_Weight->GetTensorInfo(), m_Weight->GetTensor<void*>()) ;
- ConstTensor biasTensor(m_Bias->GetTensorInfo(), m_Bias->GetConstTensor<void*>());
+ ConstTensor weightsTensor(m_Weight->GetTensorInfo(), m_Weight->Map(true)) ;
if (GetParameters().m_BiasEnabled)
{
+ ConstTensor biasTensor(m_Bias->GetTensorInfo(), m_Bias->GetConstTensor<void>());
visitor.VisitFullyConnectedLayer(this, GetParameters(), weightsTensor, biasTensor, GetName());
}
else
diff --git a/src/armnn/layers/LstmLayer.cpp b/src/armnn/layers/LstmLayer.cpp
index 06140c924f..fa836d0317 100644
--- a/src/armnn/layers/LstmLayer.cpp
+++ b/src/armnn/layers/LstmLayer.cpp
@@ -255,107 +255,107 @@ void LstmLayer::Accept(ILayerVisitor& visitor) const
if (m_CifgParameters.m_InputToInputWeights != nullptr)
{
ConstTensor inputToInputWeightsTensor(m_CifgParameters.m_InputToInputWeights->GetTensorInfo(),
- m_CifgParameters.m_InputToInputWeights->GetConstTensor<void*>());
+ m_CifgParameters.m_InputToInputWeights->Map(true));
inputParams.m_InputToInputWeights = &inputToInputWeightsTensor;
}
if (m_BasicParameters.m_InputToForgetWeights != nullptr)
{
ConstTensor inputToForgetWeightsTensor(m_BasicParameters.m_InputToForgetWeights->GetTensorInfo(),
- m_BasicParameters.m_InputToForgetWeights->GetConstTensor<void*>());
+ m_BasicParameters.m_InputToForgetWeights->Map(true));
inputParams.m_InputToForgetWeights = &inputToForgetWeightsTensor;
}
if (m_BasicParameters.m_InputToCellWeights != nullptr)
{
ConstTensor inputToCellWeightsTensor(m_BasicParameters.m_InputToCellWeights->GetTensorInfo(),
- m_BasicParameters.m_InputToCellWeights->GetConstTensor<void*>());
+ m_BasicParameters.m_InputToCellWeights->Map(true));
inputParams.m_InputToCellWeights = &inputToCellWeightsTensor;
}
if (m_BasicParameters.m_InputToOutputWeights != nullptr)
{
ConstTensor inputToOutputWeightsTensor(m_BasicParameters.m_InputToOutputWeights->GetTensorInfo(),
- m_BasicParameters.m_InputToOutputWeights->GetConstTensor<void*>());
+ m_BasicParameters.m_InputToOutputWeights->Map(true));
inputParams.m_InputToOutputWeights = &inputToOutputWeightsTensor;
}
if (m_CifgParameters.m_RecurrentToInputWeights != nullptr)
{
ConstTensor recurrentToInputWeightsTensor(
m_CifgParameters.m_RecurrentToInputWeights->GetTensorInfo(),
- m_CifgParameters.m_RecurrentToInputWeights->GetConstTensor<void*>());
+ m_CifgParameters.m_RecurrentToInputWeights->Map(true));
inputParams.m_RecurrentToInputWeights = &recurrentToInputWeightsTensor;
}
if (m_BasicParameters.m_RecurrentToForgetWeights != nullptr)
{
ConstTensor recurrentToForgetWeightsTensor(
m_BasicParameters.m_RecurrentToForgetWeights->GetTensorInfo(),
- m_BasicParameters.m_RecurrentToForgetWeights->GetConstTensor<void*>());
+ m_BasicParameters.m_RecurrentToForgetWeights->Map(true));
inputParams.m_RecurrentToForgetWeights = &recurrentToForgetWeightsTensor;
}
if (m_BasicParameters.m_RecurrentToCellWeights != nullptr)
{
ConstTensor recurrentToCellWeightsTensor(
m_BasicParameters.m_RecurrentToCellWeights->GetTensorInfo(),
- m_BasicParameters.m_RecurrentToCellWeights->GetConstTensor<void*>());
+ m_BasicParameters.m_RecurrentToCellWeights->Map(true));
inputParams.m_RecurrentToCellWeights = &recurrentToCellWeightsTensor;
}
if (m_BasicParameters.m_RecurrentToOutputWeights != nullptr)
{
ConstTensor recurrentToOutputWeightsTensor(
m_BasicParameters.m_RecurrentToOutputWeights->GetTensorInfo(),
- m_BasicParameters.m_RecurrentToOutputWeights->GetConstTensor<void*>());
+ m_BasicParameters.m_RecurrentToOutputWeights->Map(true));
inputParams.m_RecurrentToOutputWeights = &recurrentToOutputWeightsTensor;
}
if (m_CifgParameters.m_CellToInputWeights != nullptr)
{
ConstTensor cellToInputWeightsTensor(m_CifgParameters.m_CellToInputWeights->GetTensorInfo(),
- m_CifgParameters.m_CellToInputWeights->GetConstTensor<void*>());
+ m_CifgParameters.m_CellToInputWeights->Map(true));
inputParams.m_CellToInputWeights = &cellToInputWeightsTensor;
}
if (m_PeepholeParameters.m_CellToForgetWeights != nullptr)
{
ConstTensor cellToForgetWeightsTensor(m_PeepholeParameters.m_CellToForgetWeights->GetTensorInfo(),
- m_PeepholeParameters.m_CellToForgetWeights->GetConstTensor<void*>());
+ m_PeepholeParameters.m_CellToForgetWeights->Map(true));
inputParams.m_CellToForgetWeights = &cellToForgetWeightsTensor;
}
if (m_PeepholeParameters.m_CellToOutputWeights != nullptr)
{
ConstTensor cellToOutputWeightsTensor(m_PeepholeParameters.m_CellToOutputWeights->GetTensorInfo(),
- m_PeepholeParameters.m_CellToOutputWeights->GetConstTensor<void*>());
+ m_PeepholeParameters.m_CellToOutputWeights->Map(true));
inputParams.m_CellToOutputWeights = &cellToOutputWeightsTensor;
}
if (m_CifgParameters.m_InputGateBias != nullptr)
{
ConstTensor inputGateBiasTensor(m_CifgParameters.m_InputGateBias->GetTensorInfo(),
- m_CifgParameters.m_InputGateBias->GetConstTensor<void*>());
+ m_CifgParameters.m_InputGateBias->Map(true));
inputParams.m_InputGateBias = &inputGateBiasTensor;
}
if (m_BasicParameters.m_ForgetGateBias != nullptr)
{
ConstTensor forgetGateBiasTensor(m_BasicParameters.m_ForgetGateBias->GetTensorInfo(),
- m_BasicParameters.m_ForgetGateBias->GetConstTensor<void*>());
+ m_BasicParameters.m_ForgetGateBias->Map(true));
inputParams.m_ForgetGateBias = &forgetGateBiasTensor;
}
if (m_BasicParameters.m_CellBias != nullptr)
{
ConstTensor cellBiasTensor(m_BasicParameters.m_CellBias->GetTensorInfo(),
- m_BasicParameters.m_CellBias->GetConstTensor<void*>());
+ m_BasicParameters.m_CellBias->Map(true));
inputParams.m_CellBias = &cellBiasTensor;
}
if (m_BasicParameters.m_OutputGateBias != nullptr)
{
ConstTensor outputGateBias(m_BasicParameters.m_OutputGateBias->GetTensorInfo(),
- m_BasicParameters.m_OutputGateBias->GetConstTensor<void*>());
+ m_BasicParameters.m_OutputGateBias->Map(true));
inputParams.m_OutputGateBias = &outputGateBias;
}
if (m_ProjectionParameters.m_ProjectionWeights != nullptr)
{
ConstTensor projectionWeightsTensor(m_ProjectionParameters.m_ProjectionWeights->GetTensorInfo(),
- m_ProjectionParameters.m_ProjectionWeights->GetConstTensor<void*>());
+ m_ProjectionParameters.m_ProjectionWeights->Map(true));
inputParams.m_ProjectionWeights = &projectionWeightsTensor;
}
if (m_ProjectionParameters.m_ProjectionBias != nullptr)
{
ConstTensor projectionBiasTensor(m_ProjectionParameters.m_ProjectionBias->GetTensorInfo(),
- m_ProjectionParameters.m_ProjectionBias->GetConstTensor<void*>());
+ m_ProjectionParameters.m_ProjectionBias->Map(true));
inputParams.m_ProjectionBias = &projectionBiasTensor;
}