25 template <
typename CollectionType>
26 bool AreEqual(
const CollectionType& lhs,
const CollectionType& rhs)
28 if (lhs.size() != rhs.size())
33 auto lhs_it = std::find_if(lhs.begin(), lhs.end(), [&rhs](
auto& item)
35 return std::find(rhs.begin(), rhs.end(), item) == rhs.end();
38 return lhs_it == lhs.end();
42 template <
typename CollectionType>
43 bool Contains(
const CollectionType& collection,
const typename CollectionType::value_type& item)
45 return std::find(collection.begin(), collection.end(), item) != collection.end();
49 template <
typename MapType>
50 bool Contains(
const MapType& map,
const typename MapType::key_type& key)
52 return map.find(key) != map.end();
56 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
57 bool Compare(T a, T b,
float tolerance = 0.000001f)
64 return static_cast<bool>(a) == static_cast<bool>(b);
69 return std::fabs(static_cast<float>(a) - static_cast<float>(b)) <= tolerance;
72 template <
typename ConvolutionLayer>
75 layer->m_Weight = std::make_unique<armnn::ScopedTensorHandle>(weightInfo);
76 layer->m_Bias = std::make_unique<armnn::ScopedTensorHandle>(biasInfo);
78 layer->m_Weight->Allocate();
79 layer->m_Bias->Allocate();
93 unsigned int channels,
armnn::SubgraphView::InputSlots CreateInputsFrom(const std::vector< armnn::Layer *> &layers)
armnn::SubgraphView::SubgraphViewPtr CreateSubgraphViewFrom(armnn::SubgraphView::InputSlots &&inputs, armnn::SubgraphView::OutputSlots &&outputs, armnn::SubgraphView::Layers &&layers)
armnn::IBackendInternalUniquePtr CreateBackendObject(const armnn::BackendId &backendId)
bool AreEqual(const CollectionType &lhs, const CollectionType &rhs)
armnn::TensorShape MakeTensorShape(unsigned int batches, unsigned int channels, unsigned int height, unsigned int width, armnn::DataLayout layout)
std::vector< OutputSlot * > OutputSlots
armnn::SubgraphView::OutputSlots CreateOutputsFrom(const std::vector< armnn::Layer *> &layers)
std::unique_ptr< SubgraphView > SubgraphViewPtr
bool Contains(const CollectionType &collection, const typename CollectionType::value_type &item)
std::vector< InputSlot * > InputSlots
void SetWeightAndBias(ConvolutionLayer *layer, const armnn::TensorInfo &weightInfo, const armnn::TensorInfo &biasInfo)
std::unique_ptr< IBackendInternal > IBackendInternalUniquePtr
std::list< Layer * > Layers
bool Compare(T a, T b, float tolerance=0.000001f)