ONE - On-device Neural Engine
Loading...
Searching...
No Matches
ann::Weight Class Reference

#include <Weight.h>

Public Member Functions

const uint8_t * base (void) const
 
uint32_t size (void) const
 
template<typename T >
void fill (const T &value)
 
template<typename It >
void fill (It beg, It end)
 

Detailed Description

Definition at line 28 of file Weight.h.

Member Function Documentation

◆ base()

const uint8_t * ann::Weight::base ( void  ) const
inline

Definition at line 31 of file Weight.h.

31{ return _buffer.data(); }

◆ fill() [1/2]

template<typename T >
void ann::Weight::fill ( const T &  value)
inline

Definition at line 35 of file Weight.h.

36 {
37 static_assert(std::is_arithmetic<T>::value, "T should be arithmetic");
38 _buffer.clear();
39
40 auto arr = reinterpret_cast<const uint8_t *>(&value);
41
42 for (uint32_t b = 0; b < sizeof(T); ++b)
43 {
44 _buffer.emplace_back(arr[b]);
45 }
46 }
arr
Definition infer.py:92

◆ fill() [2/2]

template<typename It >
void ann::Weight::fill ( It  beg,
It  end 
)
inline

Definition at line 48 of file Weight.h.

49 {
50 _buffer.clear();
51
52 for (auto it = beg; it != end; ++it)
53 {
54 const auto value = *it;
55 auto arr = reinterpret_cast<const uint8_t *>(&value);
56
57 for (uint32_t b = 0; b < sizeof(value); ++b)
58 {
59 _buffer.emplace_back(arr[b]);
60 }
61 }
62 }
ShapeIterator end(const Shape &s)

◆ size()

uint32_t ann::Weight::size ( void  ) const
inline

Definition at line 32 of file Weight.h.

32{ return _buffer.size(); }

The documentation for this class was generated from the following file: