6 #include "../TestUtils.hpp" 11 #include <boost/test/unit_test.hpp> 13 using namespace armnn;
25 unsigned int dims[] = { 4, 2, 1, 1 };
26 std::vector<float> floatWeights{ 0.0f, -1.0f,
41 fc->
m_Weight = std::make_unique<armnn::ScopedCpuTensorHandle>(weights);
42 fc->GetOutputSlot().SetTensorInfo(
info);
48 fc->GetOutputSlot().Connect(output->GetInputSlot(0));
61 BOOST_CHECK(data[0] ==
BFloat16(0.0f));
62 BOOST_CHECK(data[1] ==
BFloat16(-1.0f));
63 BOOST_CHECK(data[2] ==
BFloat16(3.796875f));
64 BOOST_CHECK(data[3] ==
BFloat16(3.1072295E29f));
65 BOOST_CHECK(data[4] ==
BFloat16(9.131327E-10f));
66 BOOST_CHECK(data[5] ==
BFloat16(-3.796875f));
67 BOOST_CHECK(data[6] ==
BFloat16(-3.1072295E29f));
68 BOOST_CHECK(data[7] ==
BFloat16(-9.131327E-10f));
78 unsigned int dims[] = { 4, 2, 1, 1 };
79 std::vector<float> convWeightsData{ 0.f, -1.f,
87 std::vector<uint16_t> bfWeights(8);
97 fc->
m_Weight = std::make_unique<armnn::ScopedCpuTensorHandle>(weights);
98 fc->GetOutputSlot().SetTensorInfo(
info);
104 fc->GetOutputSlot().Connect(output->GetInputSlot(0));
116 float* data = fc->m_Weight->GetTensor<
float>();
117 BOOST_CHECK(data[0] == 0.0f);
118 BOOST_CHECK(data[1] == -1.0f);
119 BOOST_CHECK(data[2] == 3.796875f);
120 BOOST_CHECK(data[3] == 3.1072295E29f);
121 BOOST_CHECK(data[4] == 9.131327E-10f);
122 BOOST_CHECK(data[5] == -3.796875f);
123 BOOST_CHECK(data[6] == -3.1072295E29f);
124 BOOST_CHECK(data[7] == -9.131327E-10f);
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
Optimizer::Optimizations MakeOptimizations(Args &&... args)
std::unique_ptr< ScopedCpuTensorHandle > m_Weight
A unique pointer to store Weight values.
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
int Connect(InputSlot &destination)
static void Pass(Graph &graph, const Optimizations &optimizations)
Copyright (c) 2021 ARM Limited and Contributors.
A layer user-provided data can be bound to (e.g. inputs, outputs).
ConvertConstants< Float32ToBFloat16, IsBFloat16Layer > ConvertConstantsFloatToBFloat
This layer represents a fully connected operation.
ConvertConstants< BFloat16ToFloat32, IsFloat32Layer > ConvertConstantsBFloatToFloat
A FullyConnectedDescriptor for the FullyConnectedLayer.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
BOOST_AUTO_TEST_CASE(CheckConvolution2dLayer)
BOOST_AUTO_TEST_SUITE_END()
static void ConvertFloat32ToBFloat16(const float *srcFloat32Buffer, size_t numElements, void *dstBFloat16Buffer)
void SetTensorInfo(const TensorInfo &tensorInfo) override
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.