|
Tannic
A C++ Tensor Library
|
Expression template for flattening a contiguous range of dimensions. More...
#include <views.hpp>
Public Member Functions | |
| constexpr | Flatten (typename Trait< Source >::Reference source, int start=0, int end=-1) |
| constexpr type | dtype () const |
| constexpr Shape const & | shape () const |
| constexpr Strides const & | strides () const |
| std::ptrdiff_t | offset () const |
| Tensor | forward () const |
Expression template for flattening a contiguous range of dimensions.
| Source | The expression or tensor type being flattened. |
The Flatten view collapses dimensions between start_dim and end_dim into a single dimension. This operation only modifies tensor metadata (shape and strides) and does not move data.
Example:
|
inlineconstexpr |
|
inlineconstexpr |
This is forwarded directly from the source expression. Flatten does not alter the tensor’s dtype.
| Tensor tannic::expression::Flatten< Source >::forward |
|
inline |
This is forwarded from the source tensor since flatten does not change the starting position of the data.
|
inlineconstexpr |
Calculation:
start are copied unchanged.start and end (inclusive) are collapsed into a single dimension equal to the product of their sizes.end are copied unchanged.Example:
|
inlineconstexpr |
Calculation:
start are copied unchanged.end). end_dim are copied unchanged.Example: