BlackCat_Tensors
A GPU-supported autograd and linear algebra library, designed for neural network construction
Public Types | Public Member Functions | Public Attributes | List of all members
bc::nn::Function< SystemTag, ValueType, Functor, InputDimension > Struct Template Reference

#include <unaryfunction.h>

Inheritance diagram for bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >:
Inheritance graph
[legend]
Collaboration diagram for bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >:
Collaboration graph
[legend]

Public Types

using system_tag = SystemTag
 
using value_type = ValueType
 
using allocator_type = nn_default_allocator_type< ValueType, SystemTag >
 
using self_type = Function< SystemTag, ValueType, Functor, InputDimension >
 
using input_descriptor_t = Tensor_Descriptor< ValueType, SystemTag, InputDimension >
 
using parent_type = Layer_Base< self_type, input_descriptor_t >
 
using input_tensor_dim = InputDimension
 
using output_tensor_dim = InputDimension
 
using shape_type = bc::Dim< input_tensor_dim::value >
 
- Public Types inherited from bc::nn::Layer_Base< Function< SystemTag, ValueType, Functor, InputDimension >, Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
using value_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::value_type
 
using system_tag = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::system_tag
 
using allocator_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::allocator_type
 
using input_tensor_dim = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::tensor_dim
 
using shape_type = bc::Dim< input_tensor_dim::value >
 
using input_tensor_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::type
 
using batched_input_tensor_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::batched_type
 
using output_value_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::value_type
 
using output_system_tag = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::system_tag
 
using output_allocator_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::allocator_type
 
using output_tensor_dim = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::tensor_dim
 
using output_shape_type = bc::Dim< output_tensor_dim::value >
 
using output_tensor_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::type
 
using batched_output_tensor_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::batched_type
 
- Public Types inherited from bc::nn::Layer_Output_Base< Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
using output_value_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::value_type
 
using output_value_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::value_type
 
using output_system_tag = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::system_tag
 
using output_system_tag = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::system_tag
 
using output_allocator_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::allocator_type
 
using output_allocator_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::allocator_type
 
using output_tensor_dim = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::tensor_dim
 
using output_tensor_dim = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::tensor_dim
 
using output_shape_type = bc::Dim< output_tensor_dim::value >
 
using output_shape_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::shape_type
 
using output_tensor_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::type
 
using output_tensor_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::tensor_type
 
using batched_output_tensor_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::batched_type
 
using batched_output_tensor_type = typename Tensor_Descriptor< ValueType, SystemTag, InputDimension > ::batched_type
 
using next_layer_type = Layer_Input_Base< Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
 
using next_layer_type = Layer_Input_Base< Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
 

Public Member Functions

 Function (shape_type inputs, Functor function=Functor())
 
template<class Matrix >
auto forward_propagation (const Matrix &x)
 
template<class X , class Delta >
auto back_propagation (const X &x, const Delta &dy)
 
- Public Member Functions inherited from bc::nn::Layer_Base< Function< SystemTag, ValueType, Functor, InputDimension >, Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
 Layer_Base (std::string classname, shape_type input_shape, output_shape_type output_shape)
 m_classname should be initialized by supplying __func__ to the first argument of the Layer_Base. More...
 
 Layer_Base (std::string classname, shape_type input_shape)
 
virtual ~Layer_Base ()
 
virtual output_shape_type get_output_shape () const
 
virtual shape_type get_input_shape () const
 
auto get_batched_input_shape () const
 
auto get_batched_output_shape () const
 
bc::size_t input_size () const
 
bc::size_t output_size () const
 
bc::size_t batch_size () const
 
bc::size_t batched_input_size () const
 
bc::size_t batched_output_size () const
 
void set_batch_size (int batch_size)
 
virtual void set_batch_size_hook (int batch_size)
 
void set_learning_rate (value_type learning_rate)
 
virtual void set_learning_rate_hook (value_type learning_rate)
 
auto get_learning_rate () const
 
auto get_batched_learning_rate () const
 
virtual void save (Layer_Loader &) const
 
virtual void save_from_cache (Layer_Loader &, const Cache &) const
 
virtual void load (Layer_Loader &)
 
virtual void load_to_cache (Layer_Loader &, const Cache &)
 
void copy_training_data_to_single_predict (Cache &, int batch_index)
 
void update_weights ()
 
void clear_bp_storage (Cache &)
 
const std::string & classname () const
 Returns the derived_classes class namepse. More...
 
std::string get_string_architecture () const
 
virtual std::string get_string_architecture_hook () const
 
auto default_input_tensor_factory () const
 
auto default_output_tensor_factory () const
 
auto default_batched_input_tensor_factory () const
 
auto default_batched_output_tensor_factory () const
 
- Public Member Functions inherited from bc::nn::Layer_Input_Base< Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
void set_prev (prev_layer_type &prev)
 
void set_prev (prev_layer_type &prev)
 
input_shape_type input_shape () const
 
input_shape_type input_shape () const
 
const prev_layer_typeprev_layer () const
 
prev_layer_typeprev_layer ()
 
const prev_layer_typeprev_layer () const
 
prev_layer_typeprev_layer ()
 
virtual ~Layer_Input_Base ()
 
virtual ~Layer_Input_Base ()
 
- Public Member Functions inherited from bc::nn::Layer_Output_Base< Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
void set_next (next_layer_type &next)
 
void set_next (next_layer_type &next)
 
output_shape_type output_shape () const
 
output_shape_type output_shape () const
 
const next_layer_typenext_layer () const
 
next_layer_typenext_layer ()
 
const next_layer_typenext_layer () const
 
next_layer_typenext_layer ()
 
virtual ~Layer_Output_Base ()
 
virtual ~Layer_Output_Base ()
 

Public Attributes

Functor function
 

Additional Inherited Members

- Static Public Member Functions inherited from bc::nn::Layer_Base< Function< SystemTag, ValueType, Functor, InputDimension >, Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
static std::string parse_classname (std::string classname)
 
- Static Public Attributes inherited from bc::nn::Layer_Base< Function< SystemTag, ValueType, Functor, InputDimension >, Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
static constexpr value_type default_learning_rate
 
- Protected Attributes inherited from bc::nn::Layer_Base< Function< SystemTag, ValueType, Functor, InputDimension >, Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
shape_type m_input_shape
 
output_shape_type m_output_shape
 
- Protected Attributes inherited from bc::nn::Layer_Input_Base< Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
prev_layer_typem_prev_layer
 
input_shape_type m_input_shape
 
- Protected Attributes inherited from bc::nn::Layer_Output_Base< Tensor_Descriptor< ValueType, SystemTag, InputDimension > >
next_layer_typem_next_layer
 
bc::Dim< output_tensor_dim::value > m_output_shape
 

Member Typedef Documentation

◆ allocator_type

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
using bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::allocator_type = nn_default_allocator_type<ValueType, SystemTag>

◆ input_descriptor_t

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
using bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::input_descriptor_t = Tensor_Descriptor<ValueType, SystemTag, InputDimension>

◆ input_tensor_dim

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
using bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::input_tensor_dim = InputDimension

◆ output_tensor_dim

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
using bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::output_tensor_dim = InputDimension

◆ parent_type

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
using bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::parent_type = Layer_Base<self_type, input_descriptor_t>

◆ self_type

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
using bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::self_type = Function<SystemTag, ValueType, Functor,InputDimension>

◆ shape_type

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
using bc::nn::Layer_Base< DerivedLayer, InputTensorDescriptor, OutputTensorDescriptor >::shape_type = bc::Dim<input_tensor_dim::value>

◆ system_tag

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
using bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::system_tag = SystemTag

◆ value_type

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
using bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::value_type = ValueType

Constructor & Destructor Documentation

◆ Function()

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::Function ( shape_type  inputs,
Functor  function = Functor() 
)
inline

Member Function Documentation

◆ back_propagation()

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
template<class X , class Delta >
auto bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::back_propagation ( const X &  x,
const Delta &  dy 
)
inline

◆ forward_propagation()

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
template<class Matrix >
auto bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::forward_propagation ( const Matrix x)
inline

Member Data Documentation

◆ function

template<class SystemTag, class ValueType, class Functor, class InputDimension = bc::traits::Integer<1>>
Functor bc::nn::Function< SystemTag, ValueType, Functor, InputDimension >::function

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