ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::misc::feature Namespace Reference

Data Structures

class  Index
 Class to have the index information for calculating the offset. More...
 
class  IndexIterator
 Class to iterate Callable with Index of feature. More...
 
class  Object
 Class to have information of the operand for feature. More...
 
struct  Reader
 Class reads values of feature The interface class. More...
 
struct  Shape
 Structure to have values of dimensions for feature. More...
 
class  TextFormatter
 Class to print operand of feature to ostream in the given string format. More...
 

Functions

template<typename Callable >
IndexIteratoroperator<< (IndexIterator &&it, Callable cb)
 Call a function iterated using IndexIterator of feature Overloaded operator<<.
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const TextFormatter< T > &fmt)
 Print operand of feature.
 

Function Documentation

◆ operator<<() [1/2]

template<typename Callable >
IndexIterator & nnfw::misc::feature::operator<< ( IndexIterator &&  it,
Callable  cb 
)

Call a function iterated using IndexIterator of feature Overloaded operator<<.

Parameters
[in]itAn IndexIterator reference
[in]cbA callback function
Returns
created IndexIterator object

Definition at line 96 of file IndexIterator.h.

97{
98 return it.iter(cb);
99}
IndexIterator & iter(Callable cb)
Call a function iterated.

References nnfw::misc::feature::IndexIterator::iter().

◆ operator<<() [2/2]

template<typename T >
std::ostream & nnfw::misc::feature::operator<< ( std::ostream &  os,
const TextFormatter< T > &  fmt 
)

Print operand of feature.

Parameters
[in]osStandard output stream
[in]fmtTextFormatter to print information of an operand
Returns
Standard output stream

Definition at line 85 of file TextFormatter.h.

86{
87 const auto &shape = fmt.shape();
88
89 for (uint32_t ch = 0; ch < shape.C; ++ch)
90 {
91 os << " Channel " << ch << ":" << std::endl;
92 for (uint32_t row = 0; row < shape.H; ++row)
93 {
94 os << " ";
95 for (uint32_t col = 0; col < shape.W; ++col)
96 {
97 const auto value = fmt.data().at(ch, row, col);
98 os << std::right;
99 os << std::fixed;
100 os << std::setw(std::numeric_limits<T>::digits10 + 2);
101 os << std::setprecision(5);
102 os << value;
103 os << " ";
104 }
105 os << std::endl;
106 }
107 }
108
109 return os;
110}