Tannic
A C++ Tensor Library
|
Namespaces | |
namespace | expression |
namespace | function |
namespace | indexing |
namespace | operation |
namespace | transformation |
Classes | |
class | Buffer |
Managed memory buffer with explicit ownership. More... | |
class | Callback |
class | Device |
Device memory domain. More... | |
class | Devices |
Device enumeration singleton. More... | |
class | Exception |
A simple generic exception type for the Tannic Tensor Library. More... | |
struct | Header |
class | Host |
Host memory domain. More... | |
struct | Metadata |
struct | Metadata< Tensor > |
struct | Node |
class | Shape |
Represents the shape (dimensions) of an tensor-like expression. More... | |
class | Strides |
Represents the memory strides associated with a tensor shape. More... | |
class | Tensor |
A multidimensional, strided tensor data structure. More... | |
struct | Trait |
Concepts | |
concept | Expression |
Defines the core protocol for all expression-like types in the Tannic Tensor Library. | |
concept | Operator |
Concept defining requirements for tensor operation types. | |
concept | Functional |
Concept for unary mathematical function operations. | |
concept | Iterable |
Requires a type to be iterable via std::begin and std::end . | |
concept | Iterator |
Requires a type to satisfy the C++20 std::input_iterator concept. | |
concept | Integral |
Requires a type to be an integral type (e.g., int , std::size_t ). | |
concept | Assignable |
Concept for types that can assign values. | |
concept | Comparable |
Concept for types that can compare their value. | |
Typedefs | |
using | range = indexing::Range |
Convenience alias for tannic::indexing::Range . | |
using | Environment = std::variant< Host, Device > |
Memory environment variant type. | |
Functions | |
Header | headerof (Tensor const &tensor) |
Metadata< Tensor > | metadataof (Tensor const &tensor) |
constexpr bool | operator== (Shape const &first, Shape const &second) |
Equality comparison operator for shapes. | |
std::ostream & | operator<< (std::ostream &os, Shape const &shape) |
constexpr bool | operator== (Strides const &first, Strides const &second) |
Equality comparison for strides. | |
std::ostream & | operator<< (std::ostream &os, Strides const &strides) |
std::ostream & | operator<< (std::ostream &ostream, Tensor const &tensor) |
template<Expression Source> | |
std::ostream & | operator<< (std::ostream &ostream, Source source) |
template<Expression Multiplicand, Expression Multiplier> | |
constexpr auto | matmul (Multiplicand &&multiplicand, Multiplier &&multiplier, double scale=1.0) |
Matrix multiplication convenience function. | |
constexpr std::size_t | dsizeof (type type) |
Returns the size in bytes of a given tensor data type. | |
constexpr std::size_t | nbytesof (type dtype, std::size_t nelements) |
Returns the total number of bytes required to store nelements elements of the given data type. | |
constexpr std::string | dnameof (type type) |
Returns the string name of a given tensor data type. | |
constexpr uint8_t | dcodeof (type type) |
Returns the numeric code used for serialization of a data type. | |
constexpr type | dtypeof (uint8_t code) |
Converts a numeric type code back to its corresponding type enum. | |
template<typename T > | |
constexpr type | dtypeof () |
std::ostream & | operator<< (std::ostream &ostream, type type) |
Variables | |
constexpr uint32_t | MAGIC = 0x43495245 |
using tannic::Environment = typedef std::variant<Host, Device> |
Memory environment variant type.
Type-safe union of host and device memory environments.
Convenience alias for tannic::indexing::Range
.
This alias allows using tannic::range
directly when declaring slices without fully qualifying the indexing::Range
type.
|
inlineconstexpr |
Returns the numeric code used for serialization of a data type.
type | The data type to query |
none
)While this grouping is intentional, it's not strictly enforced. When adding new types:
|
inlineconstexpr |
Returns the string name of a given tensor data type.
type | The data type to query |
|
inlineconstexpr |
Returns the size in bytes of a given tensor data type.
type | The data type to query |
none
)boolean
is stored as bit-packed (1 bit per element). Since the size is less than one byte, this function returns 0. To compute the actual storage requirement for N elements, use (N + 7) / 8
bytes.complex64
returns 8 (2 × float32).complex128
returns 16 (2 × float64).
|
inlineconstexpr |
|
inlineconstexpr |
Converts a numeric type code back to its corresponding type enum.
Used for deserialization.
code | The numeric type code to convert (as returned by dcodeof()) |
|
constexpr |
Matrix multiplication convenience function.
Multiplicand | Left tensor expression type |
Multiplier | Right tensor expression type |
multiplicand | Left tensor operand |
multiplier | Right tensor operand |
|
inlineconstexpr |
Returns the total number of bytes required to store nelements
elements of the given data type.
type | The data type. |
nelements | Number of elements. |
boolean
, storage is bit-packed. The result is (nelements + 7) / 8
.dsizeof(type) * nelements
.
|
inline |
|
inline |
|
inline |
std::ostream & tannic::operator<< | ( | std::ostream & | ostream, |
Tensor const & | tensor | ||
) |
|
inline |
Equality comparison operator for shapes.
first | First shape. |
second | Second shape. |
Equality comparison for strides.
|
constexpr |