Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
uni20::async::ReverseValue< T > Class Template Reference

Reverse-mode accumulation endpoint with staged input/output gradient channels. More...

#include <reverse_value.hpp>

Public Types

using value_type = T
 

Public Member Functions

Async< T > & backprop () &
 Finalize and return mutable access to the backprop async channel.
 
Async< T > backprop () &&
 Finalize and move out the backprop async channel.
 
Async< T > const & backprop () const &
 Finalize and return const access to the backprop async channel.
 
Async< T > final ()
 Finalize and return the underlying async gradient channel.
 
T final_wait ()
 Finalize and synchronously wait for the terminal gradient value.
 
void finalize () const
 Ensure the reverse queue has been started exactly once.
 
T get_wait ()
 Wait for and return the final gradient value.
 
ReadBuffer< T > input () const
 Get the input-gradient read buffer from the earliest reverse epoch.
 
Async< T > & last_value () &
 Access the latest internal async value without forcing finalization.
 
Async< T > last_value () &&
 Move out the latest internal async value without forcing finalization.
 
Async< T > const & last_value () const &
 Access the latest internal async value without forcing finalization.
 
template<typename U >
ReverseValue & operator+= (Async< U > const &v)
 Accumulate an async source into this reverse channel.
 
template<typename U >
ReverseValue & operator+= (ReadBuffer< U > v)
 Accumulate a read buffer source into this channel.
 
template<typename U >
ReverseValue & operator+= (ReverseValue< U > const &v)
 Accumulate another reverse channel into this channel.
 
template<typename U >
ReverseValue & operator-= (Async< U > const &v)
 Subtract an async source from this reverse channel.
 
template<typename U >
ReverseValue & operator-= (ReadBuffer< U > v)
 Subtract a read-buffer source from this channel.
 
template<typename U >
ReverseValue & operator-= (ReverseValue< U > const &v)
 Subtract another reverse channel from this channel.
 
template<typename U >
ReverseValue & operator= (Async< U > &&v)
 Move-assign from an async source by scheduling an async move.
 
template<typename U >
ReverseValue & operator= (Async< U > const &v)
 Assign from an async source by scheduling an async copy.
 
ReverseValue & operator= (ReverseValue &&other) noexcept
 Move assignment finalizes any pending chain before transfer.
 
template<typename U >
requires std::constructible_from<T, U&&>
ReverseValue & operator= (U &&v)
 Immediately assign a terminal gradient value.
 
WriteBuffer< T > output ()
 Get the output-gradient write buffer for downstream accumulation.
 
ReadBuffer< T > read () const
 Alias for input().
 
 ReverseValue ()
 Construct a new, uninitialized ReverseValue.
 
 ReverseValue (ReverseValue &&) noexcept=default
 Move constructor.
 
 ReverseValue (ReverseValue const &)=delete
 Non-copyable.
 
void start ()
 Explicitly start the reverse queue.
 
void wait ()
 Finalize and synchronously wait for the terminal gradient to complete.
 
 ~ReverseValue ()
 Access as an Async<T> (read-only use).
 

Detailed Description

template<typename T>
class uni20::async::ReverseValue< T >

Reverse-mode accumulation endpoint with staged input/output gradient channels.

Template Parameters
TGradient value type.

Member Typedef Documentation

◆ value_type

template<typename T >
using uni20::async::ReverseValue< T >::value_type = T

Constructor & Destructor Documentation

◆ ReverseValue() [1/3]

template<typename T >
uni20::async::ReverseValue< T >::ReverseValue ( )
inline

Construct a new, uninitialized ReverseValue.

◆ ReverseValue() [2/3]

template<typename T >
uni20::async::ReverseValue< T >::ReverseValue ( ReverseValue< T > &&  )
defaultnoexcept

Move constructor.

◆ ReverseValue() [3/3]

template<typename T >
uni20::async::ReverseValue< T >::ReverseValue ( ReverseValue< T > const &  )
delete

Non-copyable.

◆ ~ReverseValue()

template<typename T >
uni20::async::ReverseValue< T >::~ReverseValue ( )
inline

Access as an Async<T> (read-only use).

Get the final gradient value; also finalizes the computation chain.

Destructor finalizes the reverse queue if needed.

Member Function Documentation

◆ backprop() [1/3]

template<typename T >
Async< T > & uni20::async::ReverseValue< T >::backprop ( ) &
inline

Finalize and return mutable access to the backprop async channel.

Returns
Mutable reference to finalized async gradient channel.

◆ backprop() [2/3]

template<typename T >
Async< T > uni20::async::ReverseValue< T >::backprop ( ) &&
inline

Finalize and move out the backprop async channel.

Returns
Finalized async gradient channel.

◆ backprop() [3/3]

template<typename T >
Async< T > const & uni20::async::ReverseValue< T >::backprop ( ) const &
inline

Finalize and return const access to the backprop async channel.

Returns
Const reference to finalized async gradient channel.

◆ final()

template<typename T >
Async< T > uni20::async::ReverseValue< T >::final ( )
inline

Finalize and return the underlying async gradient channel.

Returns
Finalized async gradient channel.

◆ final_wait()

template<typename T >
T uni20::async::ReverseValue< T >::final_wait ( )
inline

Finalize and synchronously wait for the terminal gradient value.

Returns
Final gradient value.

◆ finalize()

template<typename T >
void uni20::async::ReverseValue< T >::finalize ( ) const
inline

Ensure the reverse queue has been started exactly once.

◆ get_wait()

template<typename T >
T uni20::async::ReverseValue< T >::get_wait ( )
inline

Wait for and return the final gradient value.

Returns
Final gradient value copied from the finalized reverse channel.

◆ input()

template<typename T >
ReadBuffer< T > uni20::async::ReverseValue< T >::input ( ) const
inline

Get the input-gradient read buffer from the earliest reverse epoch.

Returns
Read buffer used as input to upstream reverse operations.

◆ last_value() [1/3]

template<typename T >
Async< T > & uni20::async::ReverseValue< T >::last_value ( ) &
inline

Access the latest internal async value without forcing finalization.

Returns
Mutable reference to the underlying async channel.

◆ last_value() [2/3]

template<typename T >
Async< T > uni20::async::ReverseValue< T >::last_value ( ) &&
inline

Move out the latest internal async value without forcing finalization.

Returns
Underlying async channel.

◆ last_value() [3/3]

template<typename T >
Async< T > const & uni20::async::ReverseValue< T >::last_value ( ) const &
inline

Access the latest internal async value without forcing finalization.

Returns
Const reference to the underlying async channel.

◆ operator+=() [1/3]

template<typename T >
template<typename U >
ReverseValue & uni20::async::ReverseValue< T >::operator+= ( Async< U > const &  v)
inline

Accumulate an async source into this reverse channel.

Template Parameters
USource value type.
Parameters
vSource async value.
Returns
Reference to *this.

◆ operator+=() [2/3]

template<typename T >
template<typename U >
ReverseValue & uni20::async::ReverseValue< T >::operator+= ( ReadBuffer< U >  v)
inline

Accumulate a read buffer source into this channel.

Template Parameters
USource value type.
Parameters
vSource read buffer.
Returns
Reference to *this.

◆ operator+=() [3/3]

template<typename T >
template<typename U >
ReverseValue & uni20::async::ReverseValue< T >::operator+= ( ReverseValue< U > const &  v)
inline

Accumulate another reverse channel into this channel.

Template Parameters
USource value type.
Parameters
vSource reverse value.
Returns
Reference to *this.

◆ operator-=() [1/3]

template<typename T >
template<typename U >
ReverseValue & uni20::async::ReverseValue< T >::operator-= ( Async< U > const &  v)
inline

Subtract an async source from this reverse channel.

Template Parameters
USource value type.
Parameters
vSource async value.
Returns
Reference to *this.

◆ operator-=() [2/3]

template<typename T >
template<typename U >
ReverseValue & uni20::async::ReverseValue< T >::operator-= ( ReadBuffer< U >  v)
inline

Subtract a read-buffer source from this channel.

Template Parameters
USource value type.
Parameters
vSource read buffer.
Returns
Reference to *this.

◆ operator-=() [3/3]

template<typename T >
template<typename U >
ReverseValue & uni20::async::ReverseValue< T >::operator-= ( ReverseValue< U > const &  v)
inline

Subtract another reverse channel from this channel.

Template Parameters
USource value type.
Parameters
vSource reverse value.
Returns
Reference to *this.

◆ operator=() [1/4]

template<typename T >
template<typename U >
ReverseValue & uni20::async::ReverseValue< T >::operator= ( Async< U > &&  v)
inline

Move-assign from an async source by scheduling an async move.

Template Parameters
USource value type.
Parameters
vSource async value.
Returns
Reference to *this.

◆ operator=() [2/4]

template<typename T >
template<typename U >
ReverseValue & uni20::async::ReverseValue< T >::operator= ( Async< U > const &  v)
inline

Assign from an async source by scheduling an async copy.

Template Parameters
USource value type.
Parameters
vSource async value.
Returns
Reference to *this.

◆ operator=() [3/4]

template<typename T >
ReverseValue & uni20::async::ReverseValue< T >::operator= ( ReverseValue< T > &&  other)
inlinenoexcept

Move assignment finalizes any pending chain before transfer.

Parameters
otherSource reverse value.
Returns
Reference to *this.

◆ operator=() [4/4]

template<typename T >
template<typename U >
requires std::constructible_from<T, U&&>
ReverseValue & uni20::async::ReverseValue< T >::operator= ( U &&  v)
inline

Immediately assign a terminal gradient value.

Template Parameters
USource type constructible as T.
Parameters
vSource value.
Returns
Reference to *this.

◆ output()

template<typename T >
WriteBuffer< T > uni20::async::ReverseValue< T >::output ( )
inline

Get the output-gradient write buffer for downstream accumulation.

Returns
Write buffer for feeding gradient contributions.

◆ read()

template<typename T >
ReadBuffer< T > uni20::async::ReverseValue< T >::read ( ) const
inline

Alias for input().

Returns
Read buffer used as input to upstream reverse operations.

◆ start()

template<typename T >
void uni20::async::ReverseValue< T >::start ( )
inline

Explicitly start the reverse queue.

◆ wait()

template<typename T >
void uni20::async::ReverseValue< T >::wait ( )
inline

Finalize and synchronously wait for the terminal gradient to complete.


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