10 #include <doctest/doctest.h> 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), {});
73 std::string
const filePathString{filePath.string()};
74 std::ofstream file { filePathString };
92 {{
"SaveCachedNetwork",
true}, {
"CachedNetworkFilePath", filePathString}});
94 {{
"SaveCachedNetwork",
false}, {
"CachedNetworkFilePath", filePathString}});
99 *net1, backends, runtime->GetDeviceSpec(), optimizerOptions1);
101 *net2, backends, runtime->GetDeviceSpec(), optimizerOptions2);
106 CHECK(fs::is_empty(filePathString));
113 CHECK(fs::exists(filePathString));
114 std::vector<char> dataSerialized = ReadBinaryFile(filePathString);
115 CHECK(dataSerialized.size() != 0);
122 std::vector<uint8_t> outputData1(5);
123 RunInference(netId1, runtime, outputData1);
125 std::vector<uint8_t> outputData2(5);
126 RunInference(netId2, runtime, outputData2);
129 CHECK(std::equal(outputData1.begin(), outputData1.end(), outputData2.begin(), outputData2.end()));
132 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.
TEST_CASE_FIXTURE(ClContextControlFixture, "ClContextSerializerTest")
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
GPU Execution: OpenCL: ArmCompute.
Struct for the users to pass backend specific options.
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)
Returns a path to a file in the system temporary folder. If the file existed it will be deleted...
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
virtual int Connect(IInputSlot &destination)=0
static INetworkPtr Create(NetworkOptions networkOptions={})
A SoftmaxDescriptor for the SoftmaxLayer.