ONE - On-device Neural Engine
Loading...
Searching...
No Matches
ndarray Namespace Reference

Data Structures

class  Array
 
class  ContiguousSpan
 
class  Shape
 
struct  Strides
 

Typedefs

template<size_t... Nums>
using index_sequence = std::index_sequence< Nums... >
 
template<size_t _Num>
using make_index_sequence = std::make_index_sequence< _Num >
 

Functions

template<typename To , typename From >
Array< To > array_cast (Array< From > &&from, Shape newShape)
 
template<typename To , typename From >
Array< const To > array_cast (const Array< From > &from, Shape newShape)
 

Typedef Documentation

◆ index_sequence

template<size_t... Nums>
using ndarray::index_sequence = typedef std::index_sequence<Nums...>

Definition at line 36 of file Array.h.

◆ make_index_sequence

template<size_t _Num>
using ndarray::make_index_sequence = typedef std::make_index_sequence<_Num>

Definition at line 38 of file Array.h.

Function Documentation

◆ array_cast() [1/2]

template<typename To , typename From >
Array< To > ndarray::array_cast ( Array< From > &&  from,
Shape  newShape 
)

Definition at line 155 of file Array.h.

156{
157 assert(from.shape().element_count() / (sizeof(To) / sizeof(From)) == newShape.element_count());
158 return Array<To>(reinterpret_cast<To *>(from.flat().data()), newShape);
159}
const Shape & shape() const noexcept
Definition Array.h:130
ContiguousSpan< T, std::is_const< T >::value > flat() noexcept
Definition Array.h:123
size_t element_count() const noexcept
Definition Shape.h:48

References ndarray::Shape::element_count().

◆ array_cast() [2/2]

template<typename To , typename From >
Array< const To > ndarray::array_cast ( const Array< From > &  from,
Shape  newShape 
)

Definition at line 162 of file Array.h.

163{
164 assert(from.shape().element_count() / (sizeof(To) / sizeof(From)) == newShape.element_count());
165 return Array<To>(reinterpret_cast<const To *>(from.flat().data()), newShape);
166}

References ndarray::Shape::element_count(), ndarray::Array< T >::flat(), and ndarray::Array< T >::shape().