|
Tannic
A C++ Tensor Library
|
Implements views for tensors in the Tannic Tensor Library. More...
#include <utility>#include <algorithm>#include <numeric>#include <vector>#include "types.hpp"#include "traits.hpp"#include "shape.hpp"#include "strides.hpp"#include "concepts.hpp"#include "exceptions.hpp"

Go to the source code of this file.
Classes | |
| class | tannic::expression::View< Source > |
| Expression template for viewing a tensor with a new shape. More... | |
| class | tannic::expression::Transpose< Source > |
| Expression template for transposing two dimensions of a tensor. More... | |
| class | tannic::expression::Permutation< Source, Indexes > |
| Expression template for reordering tensor dimensions according to a specified permutation. More... | |
| class | tannic::expression::Expansion< Source > |
| Expression template for expanding (broadcasting) singleton dimensions of a tensor. More... | |
| class | tannic::expression::Squeeze< Source > |
| Expression template for removing singleton dimensions from a tensor. More... | |
| class | tannic::expression::Unsqueeze< Source > |
| Expression template for inserting singleton dimensions into a tensor. More... | |
| class | tannic::expression::Flatten< Source > |
| Expression template for flattening a contiguous range of dimensions. More... | |
Namespaces | |
| namespace | tannic |
| namespace | tannic::expression |
Functions | |
| template<Expression Source, Integral ... Indexes> | |
| constexpr auto | tannic::expression::view (Source &&source, Indexes ... indexes) |
| Creates a reshaped view of a tensor or expression. | |
| template<Expression Source> | |
| constexpr auto | tannic::expression::transpose (Source &&source, int first, int second) |
| Creates a transposed view of a tensor or expression by swapping two dimensions. | |
| template<Expression Source, Integral ... Indexes> | |
| constexpr auto | tannic::expression::permute (Source &&source, Indexes... indexes) |
| Creates a permuted view of a tensor or expression. | |
| template<Expression Source, Integral... Sizes> | |
| constexpr auto | tannic::expression::expand (Source &&source, Sizes... sizes) |
| Creates an expanded view of a tensor, broadcasting singleton dimensions. | |
| template<Expression Source> | |
| constexpr auto | tannic::expression::squeeze (Source &&source) |
| Removes all singleton dimensions from a tensor (squeeze). | |
| template<Expression Source, Integral... Axes> | |
| constexpr auto | tannic::expression::unsqueeze (Source &&source, Axes... axes) |
| Inserts singleton dimensions at the specified axes (unsqueeze). | |
| template<Expression Source> | |
| constexpr auto | tannic::expression::flatten (Source &&source, int start=0, int end=-1) |
| Flattens dimensions of a tensor into a single dimension. | |
Implements views for tensors in the Tannic Tensor Library.
This header defines expression templates for tensors views without copying data. These views operate on the underlying tensor metadata (shape, strides, and offset) to reinterpret how elements are accessed while preserving the original storage.
Example usage: