10 #include <boost/test/unit_test.hpp> 42 std::vector<uint8_t> inputData
54 {0,
armnn::Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data())}
58 runtime->EnqueueWorkload(netId, inputTensors, outputTensors);
61 std::vector<char> ReadBinaryFile(
const std::string& binaryFileName)
63 std::ifstream input(binaryFileName, std::ios::binary);
64 return std::vector<char>(std::istreambuf_iterator<char>(input), {});
75 std::string
const filePathString{filePath.string()};
76 std::ofstream file { filePathString };
94 {{
"SaveCachedNetwork",
true}, {
"CachedNetworkFilePath", filePathString}});
96 {{
"SaveCachedNetwork",
false}, {
"CachedNetworkFilePath", filePathString}});
101 *net1, backends, runtime->GetDeviceSpec(), optimizerOptions1);
103 *net2, backends, runtime->GetDeviceSpec(), optimizerOptions2);
104 BOOST_CHECK(optNet1);
105 BOOST_CHECK(optNet2);
108 BOOST_TEST(fs::is_empty(filePathString));
115 BOOST_TEST(fs::exists(filePathString));
116 std::vector<char> dataSerialized = ReadBinaryFile(filePathString);
117 BOOST_TEST(dataSerialized.size() != 0);
124 std::vector<uint8_t> outputData1(5);
125 RunInference(netId1, runtime, outputData1);
127 std::vector<uint8_t> outputData2(5);
128 RunInference(netId2, runtime, outputData2);
131 BOOST_CHECK_EQUAL_COLLECTIONS(outputData1.begin(), outputData1.end(),
132 outputData2.begin(), outputData2.end());
135 fs::remove(filePath);
ModelOptions m_ModelOptions
static IRuntimePtr Create(const CreationOptions &options)
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options=OptimizerOptions(), Optional< std::vector< std::string > &> messages=EmptyOptional())
Create an optimized version of the network.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
std::vector< std::pair< LayerBindingId, class Tensor > > OutputTensors
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
BOOST_AUTO_TEST_CASE(ClContextSerializerTest)
GPU Execution: OpenCL: ArmCompute.
Struct for the users to pass backend specific options.
BOOST_AUTO_TEST_SUITE_END()
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
fs::path NamedTempFile(const char *fileName)
Construct a temporary file name.
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
virtual int Connect(IInputSlot &destination)=0
static INetworkPtr Create(NetworkOptions networkOptions={})
A SoftmaxDescriptor for the SoftmaxLayer.