BlackCat_Tensors
A GPU-supported autograd and linear algebra library, designed for neural network construction
Public Types | Public Member Functions | List of all members
bc::nn::Cache Struct Reference

A Dictionary designed to store any type using the 'store' and 'load' functions. More...

#include <layer_cache.h>

Public Types

template<class K , class V , cache_key_type R>
using key_type = cache_key< K, V, R >
 

Public Member Functions

void enable_recurrent_caching (bool enable=true)
 
template<class K , class V , cache_key_type R>
bool contains (key_type< K, V, R > key) const
 
template<class K , class V >
auto & load (key_type< K, V, cache_key_type::inherit > key, int t_modifier=0) const
 
template<class K , class V , class Factory >
auto & load (key_type< K, V, cache_key_type::inherit > key, int t_modifier, Factory factory) const
 
template<class K , class V , class Factory >
auto & load (key_type< K, V, cache_key_type::inherit > key, Factory factory) const
 
template<class K , class V , class U >
auto & store (key_type< K, V, cache_key_type::inherit > key, U &&expression)
 
template<class K , class V >
auto & load (key_type< K, V, cache_key_type::always_recurrent > key, int t_modifier=0) const
 Loads the current value at the current time_index. More...
 
template<class K , class V >
auto & load (key_type< K, V, cache_key_type::always_forward > key, int t_modifier=0) const
 
template<class K , class V , class DefaultFactory >
auto & load (key_type< K, V, cache_key_type::always_recurrent > key, int t_modifier, DefaultFactory function) const
 
template<class K , class V , class DefaultFactory >
auto & load (key_type< K, V, cache_key_type::always_recurrent > key, DefaultFactory function) const
 
template<class K , class V , class DefaultFactory >
auto & load (key_type< K, V, cache_key_type::always_forward > key, DefaultFactory function) const
 
template<class K , class V , class U >
auto & store (key_type< K, V, cache_key_type::always_recurrent > key, U &&expression)
 
template<class K , class V , class U >
auto & store (key_type< K, V, cache_key_type::always_forward > key, U &&expression)
 
int get_time_index () const
 
void increment_time_index ()
 
void decrement_time_index ()
 
void zero_time_index ()
 
void set_time_index (int idx)
 
template<class K , class V >
void clear_bp_storage (key_type< K, V, cache_key_type::always_forward > key)
 
template<class K , class V >
void clear_bp_storage (key_type< K, V, cache_key_type::inherit > key)
 
template<class K , class V >
void clear_bp_storage (key_type< K, V, cache_key_type::always_recurrent > key)
 

Detailed Description

A Dictionary designed to store any type using the 'store' and 'load' functions.

The cache object stores any object that can be mapped from a unique cache_key. Additionally the Cache object stores an integer time-index which determines the current 'time' to return when loading a Value from a Recurrent key.

The time_index is only relevant with recurrent keys.

Member Typedef Documentation

◆ key_type

template<class K , class V , cache_key_type R>
using bc::nn::Cache::key_type = cache_key<K, V, R>

Member Function Documentation

◆ clear_bp_storage() [1/3]

template<class K , class V >
void bc::nn::Cache::clear_bp_storage ( key_type< K, V, cache_key_type::always_forward >  key)
inline

◆ clear_bp_storage() [2/3]

template<class K , class V >
void bc::nn::Cache::clear_bp_storage ( key_type< K, V, cache_key_type::inherit >  key)
inline

◆ clear_bp_storage() [3/3]

template<class K , class V >
void bc::nn::Cache::clear_bp_storage ( key_type< K, V, cache_key_type::always_recurrent >  key)
inline

◆ contains()

template<class K , class V , cache_key_type R>
bool bc::nn::Cache::contains ( key_type< K, V, R >  key) const
inline

◆ decrement_time_index()

void bc::nn::Cache::decrement_time_index ( )
inline

◆ enable_recurrent_caching()

void bc::nn::Cache::enable_recurrent_caching ( bool  enable = true)
inline

◆ get_time_index()

int bc::nn::Cache::get_time_index ( ) const
inline

◆ increment_time_index()

void bc::nn::Cache::increment_time_index ( )
inline

◆ load() [1/8]

template<class K , class V >
auto& bc::nn::Cache::load ( key_type< K, V, cache_key_type::inherit >  key,
int  t_modifier = 0 
) const
inline

◆ load() [2/8]

template<class K , class V , class Factory >
auto& bc::nn::Cache::load ( key_type< K, V, cache_key_type::inherit >  key,
int  t_modifier,
Factory  factory 
) const
inline

◆ load() [3/8]

template<class K , class V , class Factory >
auto& bc::nn::Cache::load ( key_type< K, V, cache_key_type::inherit >  key,
Factory  factory 
) const
inline

◆ load() [4/8]

template<class K , class V >
auto& bc::nn::Cache::load ( key_type< K, V, cache_key_type::always_recurrent >  key,
int  t_modifier = 0 
) const
inline

Loads the current value at the current time_index.

◆ load() [5/8]

template<class K , class V >
auto& bc::nn::Cache::load ( key_type< K, V, cache_key_type::always_forward >  key,
int  t_modifier = 0 
) const
inline

◆ load() [6/8]

template<class K , class V , class DefaultFactory >
auto& bc::nn::Cache::load ( key_type< K, V, cache_key_type::always_recurrent >  key,
int  t_modifier,
DefaultFactory  function 
) const
inline

◆ load() [7/8]

template<class K , class V , class DefaultFactory >
auto& bc::nn::Cache::load ( key_type< K, V, cache_key_type::always_recurrent >  key,
DefaultFactory  function 
) const
inline

◆ load() [8/8]

template<class K , class V , class DefaultFactory >
auto& bc::nn::Cache::load ( key_type< K, V, cache_key_type::always_forward >  key,
DefaultFactory  function 
) const
inline

◆ set_time_index()

void bc::nn::Cache::set_time_index ( int  idx)
inline

◆ store() [1/3]

template<class K , class V , class U >
auto& bc::nn::Cache::store ( key_type< K, V, cache_key_type::inherit >  key,
U &&  expression 
)
inline

◆ store() [2/3]

template<class K , class V , class U >
auto& bc::nn::Cache::store ( key_type< K, V, cache_key_type::always_recurrent >  key,
U &&  expression 
)
inline

◆ store() [3/3]

template<class K , class V , class U >
auto& bc::nn::Cache::store ( key_type< K, V, cache_key_type::always_forward >  key,
U &&  expression 
)
inline

◆ zero_time_index()

void bc::nn::Cache::zero_time_index ( )
inline

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