Tannic
A C++ Tensor Library
Loading...
Searching...
No Matches
tensor.hpp File Reference

Core multidimensional tensor class for the Tannic Tensor Library. More...

#include <iostream>
#include <memory>
#include <cassert>
#include <utility>
#include <initializer_list>
#include "types.hpp"
#include "shape.hpp"
#include "strides.hpp"
#include "buffer.hpp"
#include "slices.hpp"
#include "views.hpp"
#include "operations.hpp"
#include "complex.hpp"
#include "graph.hpp"
Include dependency graph for tensor.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tannic::Tensor
 A multidimensional, strided tensor data structure. More...
 

Namespaces

namespace  tannic
 

Functions

std::ostream & tannic::operator<< (std::ostream &ostream, Tensor const &tensor)
 
template<Expression Source>
std::ostream & tannic::operator<< (std::ostream &ostream, Source source)
 

Detailed Description

Core multidimensional tensor class for the Tannic Tensor Library.

Author
Eric Hermosis
Date
2025

Defines tannic::Tensor, the primary data structure of the library, supporting:

  • Dynamic dtypes: No need for templates, data types can be passed to tensors as arguments to simplify serialization and IO operations.
  • Memory management: Host(CPU)/Device(eg. CUDA) allocation support.
  • Math operators and functions: Math operators like +,*,- and matmul supported, for both CPU and CUDA tensors.
  • Slicing/views: Python-like indexing (operator[], range, transpose) with negative index.
  • Eager evaluation: Eager execution but allowing compile time optimizations like expression fusion using templates.
  • Strided storage: Non-contiguous layouts via Shape and Strides.
See also
Types.hpp(data types), Resources.hpp (Memory Managment), Functions.hpp (Supported functions)