13 #include <boost/test/unit_test.hpp> 17 template <
typename armnn::DataType DataType>
22 const float qScale = 1.0f,
23 const int32_t qOffset = 0)
25 using namespace armnn;
33 logSoftmaxDesc.
m_Beta = beta;
34 logSoftmaxDesc.
m_Axis = axis;
36 IConnectableLayer* logSoftmax = net->AddLogSoftmaxLayer(logSoftmaxDesc,
"Log_Softmax");
38 Connect(input, logSoftmax, inputTensorInfo, 0, 0);
42 Connect(logSoftmax, output, outputTensorInfo, 0, 0);
47 void LogSoftmaxEndToEnd(
const std::vector<armnn::BackendId>& backends,
50 std::vector<float>& inputData,
51 std::vector<float>& expectedOutputData,
55 using namespace armnn;
63 BOOST_TEST_CHECKPOINT(
"Create a network");
65 std::map<int, std::vector<float>> inputTensorData = { {0, inputData} };
66 std::map<int, std::vector<float>> expectedOutputTensorData = { {0, expectedOutputData} };
68 EndToEndLayerTestImpl<DataType::Float32, DataType::Float32>(move(net),
70 expectedOutputTensorData,
78 using namespace armnn;
80 const float beta = 10.0f;
89 std::vector<float> inputData = std::vector<float>({
90 0.0f, -0.6f, 0.2f, 0.4f,
91 0.3f, -0.2f, 1.0f, 0.1f
94 std::vector<float> expectedOutputData = std::vector<float>({
95 -4.14297f, -10.14297f, -2.14297f, -0.14297f,
96 -7.00104f, -12.00104f, -0.00104087f, -9.00104f
99 LogSoftmaxEndToEnd(defaultBackends,
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
const TensorShape & GetShape() const
void LogSoftmaxEndToEndTest(const std::vector< armnn::BackendId > &defaultBackends)
float m_Beta
Exponentiation value.
Copyright (c) 2020 ARM Limited.
std::vector< armnn::BackendId > defaultBackends
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
A SoftmaxDescriptor for the SoftmaxLayer.
static INetworkPtr Create()