ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci_interpreter::kernels::VectorOfTensors< T, is_const > Class Template Reference

#include <Utils.h>

Public Types

using ElementT = typename std::conditional< is_const, const T, T >::type
 
using TensorT = typename std::conditional< is_const, const Tensor, Tensor >::type
 
using ElementT = typename std::conditional< is_const, const T, T >::type
 
using TensorT = typename std::conditional< is_const, const Tensor, Tensor >::type
 

Public Member Functions

 VectorOfTensors (const std::vector< TensorT * > &tensor_list)
 
ElementT *const * data () const
 
const tflite::RuntimeShape *const * shapes () const
 
 VectorOfTensors (const std::vector< TensorT * > &tensor_list)
 
ElementT *const * data () const
 
const luci_interpreter::RuntimeShape *const * shapes () const
 

Detailed Description

template<typename T, bool is_const>
class luci_interpreter::kernels::VectorOfTensors< T, is_const >

Definition at line 220 of file Utils.h.

Member Typedef Documentation

◆ ElementT [1/2]

template<typename T , bool is_const>
using luci_interpreter::kernels::VectorOfTensors< T, is_const >::ElementT = typename std::conditional<is_const, const T, T>::type

Definition at line 223 of file Utils.h.

◆ ElementT [2/2]

template<typename T , bool is_const>
using luci_interpreter::kernels::VectorOfTensors< T, is_const >::ElementT = typename std::conditional<is_const, const T, T>::type

Definition at line 176 of file Utils.h.

◆ TensorT [1/2]

template<typename T , bool is_const>
using luci_interpreter::kernels::VectorOfTensors< T, is_const >::TensorT = typename std::conditional<is_const, const Tensor, Tensor>::type

Definition at line 224 of file Utils.h.

◆ TensorT [2/2]

template<typename T , bool is_const>
using luci_interpreter::kernels::VectorOfTensors< T, is_const >::TensorT = typename std::conditional<is_const, const Tensor, Tensor>::type

Definition at line 177 of file Utils.h.

Constructor & Destructor Documentation

◆ VectorOfTensors() [1/2]

template<typename T , bool is_const>
luci_interpreter::kernels::VectorOfTensors< T, is_const >::VectorOfTensors ( const std::vector< TensorT * > &  tensor_list)
inlineexplicit

Definition at line 227 of file Utils.h.

228 {
229 const int num_tensors = tensor_list.size();
230
231 all_data_.reserve(num_tensors);
232 all_shape_.reserve(num_tensors);
233 all_shape_ptr_.reserve(num_tensors);
234
235 for (TensorT *tensor : tensor_list)
236 {
237 all_data_.push_back(getTensorData<T>(tensor));
238 all_shape_.push_back(getTensorShape(tensor));
239 }
240
241 // Taking the pointer from inside a std::vector is only OK if the vector is
242 // never modified, so we populate all_shape in the previous loop and then we
243 // are free to grab iterators here.
244 for (tflite::RuntimeShape &shape : all_shape_)
245 {
246 all_shape_ptr_.push_back(&shape);
247 }
248 }
typename std::conditional< is_const, const Tensor, Tensor >::type TensorT
Definition Utils.h:224
tflite::RuntimeShape getTensorShape(const Tensor *tensor)
Definition Utils.h:194

References luci_interpreter::kernels::getTensorShape().

◆ VectorOfTensors() [2/2]

template<typename T , bool is_const>
luci_interpreter::kernels::VectorOfTensors< T, is_const >::VectorOfTensors ( const std::vector< TensorT * > &  tensor_list)
inlineexplicit

Definition at line 180 of file Utils.h.

181 {
182 const int num_tensors = tensor_list.size();
183
184 all_data_.reserve(num_tensors);
185 all_shape_.reserve(num_tensors);
186 all_shape_ptr_.reserve(num_tensors);
187
188 for (TensorT *tensor : tensor_list)
189 {
190 all_data_.push_back(getTensorData<T>(tensor));
191 all_shape_.push_back(getTensorShape(tensor));
192 }
193
194 // Taking the pointer from inside a std::vector is only OK if the vector is
195 // never modified, so we populate all_shape in the previous loop and then we
196 // are free to grab iterators here.
197 for (luci_interpreter::RuntimeShape &shape : all_shape_)
198 {
199 all_shape_ptr_.push_back(&shape);
200 }
201 }

References luci_interpreter::kernels::getTensorShape().

Member Function Documentation

◆ data() [1/2]

template<typename T , bool is_const>
ElementT *const * luci_interpreter::kernels::VectorOfTensors< T, is_const >::data ( ) const
inline

Definition at line 253 of file Utils.h.

253{ return all_data_.data(); }

◆ data() [2/2]

template<typename T , bool is_const>
ElementT *const * luci_interpreter::kernels::VectorOfTensors< T, is_const >::data ( ) const
inline

Definition at line 206 of file Utils.h.

206{ return all_data_.data(); }

◆ shapes() [1/2]

template<typename T , bool is_const>
const tflite::RuntimeShape *const * luci_interpreter::kernels::VectorOfTensors< T, is_const >::shapes ( ) const
inline

Definition at line 259 of file Utils.h.

259{ return all_shape_ptr_.data(); }

◆ shapes() [2/2]

template<typename T , bool is_const>
const luci_interpreter::RuntimeShape *const * luci_interpreter::kernels::VectorOfTensors< T, is_const >::shapes ( ) const
inline

Definition at line 212 of file Utils.h.

212{ return all_shape_ptr_.data(); }

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