ArmNN
 25.11
Loading...
Searching...
No Matches
ViewsDescriptor Struct Reference

A ViewsDescriptor for the SplitterLayer. More...

#include <Descriptors.hpp>

Inheritance diagram for ViewsDescriptor:
[legend]
Collaboration diagram for ViewsDescriptor:
[legend]

Public Member Functions

 ViewsDescriptor (uint32_t numViews, uint32_t numDimensions=4)
 ViewsDescriptor (const ViewsDescriptor &other)
 ViewsDescriptor ()
 ViewsDescriptor (ViewsDescriptor &&other)
 ~ViewsDescriptor ()
ViewsDescriptoroperator= (ViewsDescriptor rhs)
bool operator== (const ViewsDescriptor &rhs) const
Status SetViewOriginCoord (uint32_t view, uint32_t coord, uint32_t value)
 @Brief Set the view origin coordinates.
Status SetViewSize (uint32_t view, uint32_t coord, uint32_t value)
 Set the size of the views.
uint32_t GetNumViews () const
 Get the number of views.
uint32_t GetNumDimensions () const
 Get the number of dimensions.
const uint32_t * GetViewOrigin (uint32_t idx) const
 Get the view origin at the int value idx.
const uint32_t * GetViewSizes (uint32_t idx) const
 Get the view sizes at the int value idx.
const OriginsDescriptorGetOrigins () const
 Get the View Origins.
void SetAxis (int32_t axis)
 Set the axis value.
int32_t GetAxis () const
 Get the axis value.
bool HasAxis () const
 Returns true if an axis has been set.
Public Member Functions inherited from BaseDescriptor
virtual bool IsNull () const
virtual ~BaseDescriptor ()=default

Friends

void swap (ViewsDescriptor &first, ViewsDescriptor &second)
 Swap the ViewsDescriptor value first and second.

Detailed Description

A ViewsDescriptor for the SplitterLayer.

Descriptor to configure the splitting process. Number of Views must be equal to the number of outputs, and their order must match - e.g. first view corresponds to the first output, second view to the second output, etc.

Definition at line 244 of file Descriptors.hpp.

Constructor & Destructor Documentation

◆ ViewsDescriptor() [1/4]

ViewsDescriptor ( uint32_t numViews,
uint32_t numDimensions = 4 )

Definition at line 224 of file Descriptors.cpp.

225 : m_Origins(numViews, numDimensions)
226 , m_ViewSizes(numViews > 0 && numDimensions > 0 ?
227 new uint32_t *[numViews]() : nullptr)
228 , m_IsAxisSet(false)
229 , m_Axis(0)
230{
231 if (m_ViewSizes)
232 {
233 for (uint32_t i = 0; GetNumDimensions() > 0 && i < GetNumViews(); ++i)
234 {
235 m_ViewSizes[i] = new uint32_t[GetNumDimensions()]();
236 }
237 }
238}

References GetNumDimensions(), and GetNumViews().

Referenced by operator=(), operator==(), swap, ViewsDescriptor(), and ViewsDescriptor().

◆ ViewsDescriptor() [2/4]

ViewsDescriptor ( const ViewsDescriptor & other)

Definition at line 240 of file Descriptors.cpp.

241 : m_Origins(other.m_Origins)
242 , m_ViewSizes(other.GetNumViews() > 0 && other.GetNumDimensions() > 0 ?
243 new uint32_t *[other.GetNumViews()]() : nullptr)
244 , m_IsAxisSet(other.m_IsAxisSet)
245 , m_Axis(other.m_Axis)
246{
247 if (m_ViewSizes)
248 {
249 for (uint32_t i = 0; GetNumDimensions() > 0 && i < GetNumViews(); ++i)
250 {
251 m_ViewSizes[i] = new uint32_t[GetNumDimensions()]();
252 memcpy(m_ViewSizes[i], other.m_ViewSizes[i], GetNumDimensions() * sizeof(uint32_t));
253 }
254 }
255}

References GetNumDimensions(), GetNumViews(), and ViewsDescriptor().

◆ ViewsDescriptor() [3/4]

Definition at line 217 of file Descriptors.cpp.

218: m_Origins()
219, m_ViewSizes(nullptr)
220, m_IsAxisSet(false)
221, m_Axis(0)
222{}

◆ ViewsDescriptor() [4/4]

Definition at line 257 of file Descriptors.cpp.

258 : ViewsDescriptor()
259{
260 swap(*this, other);
261}
void swap(OriginsDescriptor &first, OriginsDescriptor &second)

References swap, and ViewsDescriptor().

◆ ~ViewsDescriptor()

Definition at line 263 of file Descriptors.cpp.

264{
265 if (m_ViewSizes)
266 {
267 for (uint32_t i = 0; GetNumDimensions() > 0 && i < GetNumViews(); ++i)
268 {
269 delete[] m_ViewSizes[i];
270 }
271 delete[] m_ViewSizes;
272 }
273}

References GetNumDimensions(), and GetNumViews().

Member Function Documentation

◆ GetAxis()

int32_t GetAxis ( ) const

Get the axis value.

Definition at line 382 of file Descriptors.cpp.

383{
384 return m_Axis;
385}

Referenced by armnn::ComputeSplitAxis(), and StringifyLayerParameters< ViewsDescriptor >::Serialize().

◆ GetNumDimensions()

◆ GetNumViews()

uint32_t GetNumViews ( ) const

Get the number of views.

Definition at line 302 of file Descriptors.cpp.

303{
304 return m_Origins.GetNumViews();
305}

Referenced by armnn::ComputeSplitAxis(), ConvertSplitToTosaOperator(), operator==(), StringifyLayerParameters< ViewsDescriptor >::Serialize(), SetViewSize(), ViewsDescriptor(), ViewsDescriptor(), and ~ViewsDescriptor().

◆ GetOrigins()

const OriginsDescriptor & GetOrigins ( ) const

Get the View Origins.

Definition at line 352 of file Descriptors.cpp.

353{
354 return m_Origins;
355}

Referenced by StringifyLayerParameters< ViewsDescriptor >::Serialize().

◆ GetViewOrigin()

const uint32_t * GetViewOrigin ( uint32_t idx) const

Get the view origin at the int value idx.

Definition at line 312 of file Descriptors.cpp.

313{
314 return m_Origins.GetViewOrigin(idx);
315}

Referenced by operator==().

◆ GetViewSizes()

const uint32_t * GetViewSizes ( uint32_t idx) const

Get the view sizes at the int value idx.

Definition at line 347 of file Descriptors.cpp.

348{
349 return m_ViewSizes ? m_ViewSizes[idx] : nullptr;
350}

Referenced by armnn::ComputeSplitAxis(), operator==(), and StringifyLayerParameters< ViewsDescriptor >::Serialize().

◆ HasAxis()

bool HasAxis ( ) const

Returns true if an axis has been set.

Definition at line 388 of file Descriptors.cpp.

389{
390 return m_IsAxisSet;
391}

Referenced by armnn::ComputeSplitAxis(), and StringifyLayerParameters< ViewsDescriptor >::Serialize().

◆ operator=()

ViewsDescriptor & operator= ( ViewsDescriptor rhs)

Definition at line 275 of file Descriptors.cpp.

276{
277 swap(*this, rhs);
278 return *this;
279}

References swap, and ViewsDescriptor().

◆ operator==()

bool operator== ( const ViewsDescriptor & rhs) const

Definition at line 281 of file Descriptors.cpp.

282{
283 if (GetNumViews() != rhs.GetNumViews() || GetNumDimensions() != rhs.GetNumDimensions())
284 {
285 return false;
286 }
287
288 for (unsigned int i = 0u; i < GetNumViews(); ++i)
289 {
290 for (unsigned int j = 0u; j < GetNumDimensions(); ++j)
291 {
292 if (GetViewOrigin(i)[j] != rhs.GetViewOrigin(i)[j] || GetViewSizes(i)[j] != rhs.GetViewSizes(i)[j])
293 {
294 return false;
295 }
296 }
297 }
298
299 return true;
300}

References GetNumDimensions(), GetNumViews(), GetViewOrigin(), GetViewSizes(), and ViewsDescriptor().

◆ SetAxis()

void SetAxis ( int32_t axis)

Set the axis value.

Definition at line 375 of file Descriptors.cpp.

376{
377 m_Axis = axis;
378 m_IsAxisSet = true;
379}

◆ SetViewOriginCoord()

Status SetViewOriginCoord ( uint32_t view,
uint32_t coord,
uint32_t value )

@Brief Set the view origin coordinates.

The arguments are: view, dimension, value. If the view is greater than or equal to GetNumViews(), then the view argument is out of range. If the coord is greater than or equal to GetNumDimensions(), then the coord argument is out of range.

Definition at line 317 of file Descriptors.cpp.

318{
319 return m_Origins.SetViewOriginCoord(view, coord, value);
320}

Referenced by ClUnidirectionalSequenceLstmFloatWorkload::ClUnidirectionalSequenceLstmFloatWorkload(), NeonUnidirectionalSequenceLstmFloatWorkload::NeonUnidirectionalSequenceLstmFloatWorkload(), and NeonUnidirectionalSequenceLstmWorkload::NeonUnidirectionalSequenceLstmWorkload().

◆ SetViewSize()

Status SetViewSize ( uint32_t view,
uint32_t coord,
uint32_t value )

Set the size of the views.

The arguments are: view, dimension, value. If the view is greater than or equal to GetNumViews(), then the view argument is out of range. If the coord is greater than or equal to GetNumDimensions(), then the coord argument is out of range.

Definition at line 322 of file Descriptors.cpp.

323{
324 if (!m_ViewSizes)
325 {
326 ARMNN_LOG(error) << "ViewsDescriptor::SetViewSize: invalid view sizes";
327 return Status::Failure;
328 }
329
330 if (view >= GetNumViews())
331 {
332 ARMNN_LOG(error) << "ViewsDescriptor::SetViewSize: view argument:" << view <<
333 " is out of range";
334 return Status::Failure;
335 }
336 if (coord >= GetNumDimensions())
337 {
338 ARMNN_LOG(error) << "ViewsDescriptor::SetViewSize: coord argument:" << coord <<
339 " is out of range";
340 return Status::Failure;
341 }
342
343 m_ViewSizes[view][coord] = value;
344 return Status::Success;
345}
#define ARMNN_LOG(severity)
Definition Logging.hpp:212

References ARMNN_LOG, armnn::error, armnn::Failure, GetNumDimensions(), GetNumViews(), and armnn::Success.

Referenced by ClUnidirectionalSequenceLstmFloatWorkload::ClUnidirectionalSequenceLstmFloatWorkload(), NeonUnidirectionalSequenceLstmFloatWorkload::NeonUnidirectionalSequenceLstmFloatWorkload(), and NeonUnidirectionalSequenceLstmWorkload::NeonUnidirectionalSequenceLstmWorkload().

◆ swap

void swap ( ViewsDescriptor & first,
ViewsDescriptor & second )
friend

Swap the ViewsDescriptor value first and second.

Definition at line 366 of file Descriptors.cpp.

367{
368 using std::swap;
369 swap(first.m_Origins, second.m_Origins);
370 swap(first.m_ViewSizes, second.m_ViewSizes);
371 swap(first.m_IsAxisSet, second.m_IsAxisSet);
372 swap(first.m_Axis, second.m_Axis);
373}

References armnn::swap(), and ViewsDescriptor().

Referenced by operator=(), and ViewsDescriptor().


The documentation for this struct was generated from the following files: