ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::misc::tensor::Zipper< T > Class Template Reference

Class to apply a function with three params: Index, elements of a tensor at passed index read by Reader objects. More...

#include <Zipper.h>

Public Member Functions

 Zipper (const Shape &shape, const Reader< T > &lhs, const Reader< T > &rhs)
 Construct a new Zipper object.
 
template<typename Callable >
void zip (Callable cb) const
 Apply cb to all elements of tensors. Elements of two tensors at passed index are read by lhs and rhs.
 

Detailed Description

template<typename T>
class nnfw::misc::tensor::Zipper< T >

Class to apply a function with three params: Index, elements of a tensor at passed index read by Reader objects.

Definition at line 41 of file Zipper.h.

Constructor & Destructor Documentation

◆ Zipper()

template<typename T >
nnfw::misc::tensor::Zipper< T >::Zipper ( const Shape shape,
const Reader< T > &  lhs,
const Reader< T > &  rhs 
)
inline

Construct a new Zipper object.

Parameters
[in]shapeShape of lhs and rhs
[in]lhsReader object of a tensor
[in]rhsReader object of a tensor

Definition at line 50 of file Zipper.h.

51 : _shape{shape}, _lhs{lhs}, _rhs{rhs}
52 {
53 // DO NOTHING
54 }

Member Function Documentation

◆ zip()

template<typename T >
template<typename Callable >
void nnfw::misc::tensor::Zipper< T >::zip ( Callable  cb) const
inline

Apply cb to all elements of tensors. Elements of two tensors at passed index are read by lhs and rhs.

Parameters
[in]cbFunction to apply
Returns
N/A

Definition at line 63 of file Zipper.h.

64 {
65 iterate(_shape) <<
66 [this, &cb](const Index &index) { cb(index, _lhs.at(index), _rhs.at(index)); };
67 }
loco::GraphInputIndex index(const TFPlaceholder *node)
Definition TFNode.cpp:54
IndexIterator iterate(const Shape &shape)
Get an IndexItator object.

References nnfw::misc::tensor::iterate().

Referenced by nnfw::misc::tensor::operator<<().


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