64 serializer->Serialize(*network);
66 std::stringstream stream;
67 serializer->SaveSerializedToStream(stream);
69 std::string
const serializerString{stream.str()};
70 std::vector<std::uint8_t>
const serializerVector{serializerString.begin(), serializerString.end()};
72 armnn::INetworkPtr deserializedNetwork = parser->CreateNetworkFromBinary(serializerVector);
74 VerifyActivationName visitor;
75 deserializedNetwork->ExecuteStrategy(visitor);
84 run->LoadNetwork(networkIdentifier, std::move(deserializedOptimized));
86 std::vector<float> inputData {0.0f, -5.3f, 42.0f, -42.0f};
89 {0,
armnn::ConstTensor(run->GetInputTensorInfo(networkIdentifier, 0), inputData.data())}
92 std::vector<float> expectedOutputData {0.0f, 0.0f, 42.0f, 0.0f};
94 std::vector<float> outputData(4);
97 {0,
armnn::Tensor(run->GetOutputTensorInfo(networkIdentifier, 0), outputData.data())}
99 run->EnqueueWorkload(networkIdentifier, inputTensors, outputTensors);
100 BOOST_CHECK_EQUAL_COLLECTIONS(outputData.begin(), outputData.end(),
101 expectedOutputData.begin(), expectedOutputData.end());
static IRuntimePtr Create(const CreationOptions &options)
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
static IDeserializerPtr Create()
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< IDeserializer, void(*)(IDeserializer *parser)> IDeserializerPtr
An ActivationDescriptor for the ActivationLayer.
float m_A
Alpha upper bound value used by the activation functions. (BoundedReLu, Linear, TanH, Elu).
std::unique_ptr< ISerializer, void(*)(ISerializer *serializer)> ISerializerPtr
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
static ISerializerPtr Create()
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
virtual int Connect(IInputSlot &destination)=0
static INetworkPtr Create(NetworkOptions networkOptions={})
float m_B
Beta lower bound value used by the activation functions. (BoundedReLu, Linear, TanH).
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu, LeakyReLu, Abs, Sqrt, Square, Elu).