Tannic
A C++ Tensor Library
Loading...
Searching...
No Matches
tannic::transformation::Transformation< Operation, Operands > Class Template Reference

Expression template for tensor transformations. More...

#include <transformations.hpp>

Public Member Functions

constexpr Transformation (Operation operation, typename Trait< Operands >::Reference... operands)
 Constructs a Transformation expression.
 
constexpr type dtype () const
 Gets the result data type after promotion.
 
constexpr Shape const & shape () const
 Gets the broadcasted output shape.
 
constexpr Strides const & strides () const
 Gets the computed strides for the result.
 
std::ptrdiff_t offset () const
 Gets the data offset (always 0 for new tensors)
 
Tensor forward () const
 Evaluates the transformation.
 

Public Attributes

Operation operation
 
std::tuple< typename Trait< Operands >::Reference... > operands
 

Detailed Description

template<class Operation, Expression ... Operands>
class tannic::transformation::Transformation< Operation, Operands >

Expression template for tensor transformations.

Represents a lazily evaluated transformation operation between multiple tensors. Handles type promotion, shape broadcasting, and proper stride computation.

Template Parameters
OperationThe transformation operation type
OperandsVariadic template for input expressions

Constructor & Destructor Documentation

◆ Transformation()

template<class Operation , Expression ... Operands>
constexpr tannic::transformation::Transformation< Operation, Operands >::Transformation ( Operation  operation,
typename Trait< Operands >::Reference...  operands 
)
inlineconstexpr

Constructs a Transformation expression.

Parameters
operationThe transformation operation
operandsInput tensor expressions

Member Function Documentation

◆ dtype()

template<class Operation , Expression ... Operands>
constexpr type tannic::transformation::Transformation< Operation, Operands >::dtype ( ) const
inlineconstexpr

Gets the result data type after promotion.

Returns
Promoted data type

◆ forward()

template<class Operation , Expression ... Operands>
Tensor tannic::transformation::Transformation< Operation, Operands >::forward ( ) const
inline

Evaluates the transformation.

Returns
New tensor containing the transformed result

◆ offset()

template<class Operation , Expression ... Operands>
std::ptrdiff_t tannic::transformation::Transformation< Operation, Operands >::offset ( ) const
inline

Gets the data offset (always 0 for new tensors)

Returns
Always returns 0

◆ shape()

template<class Operation , Expression ... Operands>
constexpr Shape const & tannic::transformation::Transformation< Operation, Operands >::shape ( ) const
inlineconstexpr

Gets the broadcasted output shape.

Returns
Shape after broadcasting and transformation

◆ strides()

template<class Operation , Expression ... Operands>
constexpr Strides const & tannic::transformation::Transformation< Operation, Operands >::strides ( ) const
inlineconstexpr

Gets the computed strides for the result.

Returns
Strides based on output shape (row-major)

Member Data Documentation

◆ operands

template<class Operation , Expression ... Operands>
std::tuple<typename Trait<Operands>::Reference...> tannic::transformation::Transformation< Operation, Operands >::operands

◆ operation

template<class Operation , Expression ... Operands>
Operation tannic::transformation::Transformation< Operation, Operands >::operation

The documentation for this class was generated from the following file: