Loading...
Searching...
No Matches
tiny_dnn::average_unpooling_layer< Activation > Class Template Reference

average pooling with trainable weights More...

`#include <average_unpooling_layer.h>`

Inheritance diagram for tiny_dnn::average_unpooling_layer< Activation >:
[legend]
Collaboration diagram for tiny_dnn::average_unpooling_layer< Activation >:
[legend]

## Public Types

typedef partial_connected_layer< Activation > | Base
Public Types inherited from tiny_dnn::partial_connected_layer< Activation >
typedef std::vector< std::pair< serial_size_t, serial_size_t > > | io_connections
typedef std::vector< std::pair< serial_size_t, serial_size_t > > | wi_connections
typedef std::vector< std::pair< serial_size_t, serial_size_t > > | wo_connections
typedef feedforward_layer< Activation > | Base

## Public Member Functions

| average_unpooling_layer (serial_size_t in_width, serial_size_t in_height, serial_size_t in_channels, serial_size_t pooling_size)
| average_unpooling_layer (serial_size_t in_width, serial_size_t in_height, serial_size_t in_channels, serial_size_t pooling_size, serial_size_t stride)
std::vector< index3d< serial_size_t > > | in_shape () const override
| array of input shapes (width x height x depth)
std::vector< index3d< serial_size_t > > | out_shape () const override
| array of output shapes (width x height x depth)
std::string | layer_type () const override
| name of layer, should be unique for each concrete class
void | forward_propagation (const std::vector< tensor_t * > &in_data, std::vector< tensor_t * > &out_data) override
void | back_propagation (const std::vector< tensor_t * > &in_data, const std::vector< tensor_t * > &out_data, std::vector< tensor_t * > &out_grad, std::vector< tensor_t * > &in_grad) override
| return delta of previous layer (delta=\frac{dE}{da}, a=wx in fully-connected layer)
Public Member Functions inherited from tiny_dnn::partial_connected_layer< Activation >
| partial_connected_layer (serial_size_t in_dim, serial_size_t out_dim, size_t weight_dim, size_t bias_dim, float_t scale_factor=float_t(1))
size_t | param_size () const
serial_size_t | fan_in_size () const override
| number of incoming connections for each output unit used only for weight/bias initialization methods which require fan-in size (e.g.
serial_size_t | fan_out_size () const override
| number of outgoing connections for each input unit used only for weight/bias initialization methods which require fan-out size (e.g.
void | connect_weight (serial_size_t input_index, serial_size_t output_index, serial_size_t weight_index)
void | connect_bias (serial_size_t bias_index, serial_size_t output_index)
void | forward_propagation (const std::vector< tensor_t * > &in_data, std::vector< tensor_t * > &out_data) override
void | back_propagation (const std::vector< tensor_t * > &in_data, const std::vector< tensor_t * > &out_data, std::vector< tensor_t * > &out_grad, std::vector< tensor_t * > &in_grad) override
| return delta of previous layer (delta=\frac{dE}{da}, a=wx in fully-connected layer)
Public Member Functions inherited from tiny_dnn::feedforward_layer< Activation >
| feedforward_layer (const std::vector< vector_type > &in_data_type)
activation::function & | activation_function ()
std::pair< float_t, float_t > | out_value_range () const override
| return output value range used only for calculating target value from label-id in final(output) layer override properly if the layer is intended to be used as output layer
void | forward_activation (tensor_t &a_tensor, tensor_t &out_tensor)
void | backward_activation (const tensor_t &prev_delta, const tensor_t &this_out, tensor_t &curr_delta)
Public Member Functions inherited from tiny_dnn::layer
| layer (const std::vector< vector_type > &in_type, const std::vector< vector_type > &out_type)
| Defaul layer constructor that instantiates a N-input, M-output layer.
| layer (const layer &)=default
layer & | operator= (const layer &)=default
void | set_parallelize (bool parallelize)
void | set_backend (std::shared_ptr< core::backend > backend)
void | set_backend_type (core::backend_t backend_type)
bool | parallelize () const
core::backend_t | backend_type () const
core::backend_t | engine () const
virtual std::string | kernel_file () const
virtual std::string | kernel_header () const
virtual void | createOp ()
void | setDevice (const Device &device)
Device * | device () const
std::shared_ptr< core::backend > | backend ()
| number of incoming edges in this layer
serial_size_t | in_channels () const
| number of outgoing edges in this layer
serial_size_t | out_channels () const
serial_size_t | in_data_size () const
serial_size_t | out_data_size () const
std::vector< shape3d > | in_data_shape ()
std::vector< shape3d > | out_data_shape ()
serial_size_t | in_size () const
| !
serial_size_t | out_size () const
| !
std::vector< const vec_t * > | weights () const
std::vector< vec_t * > | weights ()
std::vector< tensor_t * > | weights_grads ()
std::vector< edgeptr_t > | inputs ()
std::vector< edgeptr_t > | outputs ()
std::vector< edgeptr_t > | outputs () const
void | set_out_grads (const std::vector< tensor_t > &grad)
void | set_in_data (const std::vector< tensor_t > &data)
std::vector< tensor_t > | output () const
std::vector< vector_type > | in_types () const
std::vector< vector_type > | out_types () const
void | set_trainable (bool trainable)
bool | trainable () const
template<typename WeightInit >
layer & | weight_init (const WeightInit &f)
template<typename BiasInit >
layer & | bias_init (const BiasInit &f)
template<typename WeightInit >
layer & | weight_init (std::shared_ptr< WeightInit > f)
template<typename BiasInit >
layer & | bias_init (std::shared_ptr< BiasInit > f)
template<typename Archive >
void | serialize (Archive &ar)
virtual void | save (std::ostream &os) const
virtual void | load (std::istream &is)
virtual void | load (const std::vector< float_t > &src, int &idx)
virtual image | output_to_image (size_t channel=0) const
| < visualize latest output of this layer default implementation interpret output as 1d-vector, so "visual" layer(like convolutional layer) should override this for better visualization.
virtual void | post_update ()
| return delta2 of previous layer (delta2=\frac{d^2E}{da^2}, diagonal of hessian matrix) it is never called if optimizer is hessian-free
virtual void | set_context (net_phase ctx)
| notify changing context (train <=> test)
std::vector< tensor_t > | forward (const std::vector< tensor_t > &input)
std::vector< tensor_t > | backward (const std::vector< tensor_t > &out_grads)
void | forward ()
void | backward ()
void | setup (bool reset_weight)
void | init_weight ()
void | clear_grads ()
void | update_weight (optimizer *o, serial_size_t batch_size)
bool | has_same_weights (const layer &rhs, float_t eps) const
virtual void | set_sample_count (serial_size_t sample_count)
template<class Archive >
void | serialize_prolog (Archive &ar)
Public Member Functions inherited from tiny_dnn::node
| node (serial_size_t in_size, serial_size_t out_size)
const std::vector< edgeptr_t > & | prev () const
const std::vector< edgeptr_t > & | next () const
serial_size_t | prev_port (const edge &e) const
serial_size_t | next_port (const edge &e) const
std::vector< node * > | prev_nodes () const
std::vector< node * > | next_nodes () const

## Public Attributes

| CNN_USE_LAYER_MEMBERS
Public Attributes inherited from tiny_dnn::partial_connected_layer< Activation >
| CNN_USE_LAYER_MEMBERS
Public Attributes inherited from tiny_dnn::feedforward_layer< Activation >
Activation | h_

## Additional Inherited Members

Static Public Member Functions inherited from tiny_dnn::layer
template<typename InputArchive >
static std::shared_ptr< layer > | load_layer (InputArchive &ia)
| generate layer from cereal's Archive
template<typename OutputArchive >
static void | save_layer (OutputArchive &oa, const layer &l)
Protected Attributes inherited from tiny_dnn::partial_connected_layer< Activation >
std::vector< io_connections > | weight2io_
std::vector< wi_connections > | out2wi_
std::vector< wo_connections > | in2wo_
std::vector< std::vector< serial_size_t > > | bias2out_
std::vector< size_t > | out2bias_
float_t | scale_factor_
Protected Attributes inherited from tiny_dnn::layer
bool | initialized_
| Flag indication whether the layer/node is initialized.
bool | parallelize_
| Flag indicating whether the layer/node operations ara paralellized.
serial_size_t | in_channels_
| The number of input vectors/edges.
serial_size_t | out_channels_
| The number of output vectors/edges.
std::vector< vector_type > | in_type_
| Vector containing the type of data for inputs.
std::vector< vector_type > | out_type_
| Vector containing the type of data for outputs.
core::backend_t | backend_type_
| The current backend type for operations.
std::shared_ptr< core::backend > | backend_
| The backend instance (deprecated)
Device * | device_ptr_ = nullptr
| Pointer to the device on which the layer/node will run.
Protected Attributes inherited from tiny_dnn::node
std::vector< edgeptr_t > | prev_
std::vector< edgeptr_t > | next_

## Detailed Description

template<typename Activation = activation::identity>
class tiny_dnn::average_unpooling_layer< Activation >

average pooling with trainable weights

## Constructor & Destructor Documentation

## average_unpooling_layer() [1/2]

template<typename Activation = activation::identity>

tiny_dnn::average_unpooling_layer< Activation >::average_unpooling_layer | ( | serial_size_t | in_width,
|  | serial_size_t | in_height,
|  | serial_size_t | in_channels,
|  | serial_size_t | pooling_size
| ) |  |

inline

Parameters

  in_width | [in] width of input image
  in_height | [in] height of input image
  in_channels | [in] the number of input image channels(depth)
  pooling_size | [in] factor by which to upscale

## average_unpooling_layer() [2/2]

template<typename Activation = activation::identity>

tiny_dnn::average_unpooling_layer< Activation >::average_unpooling_layer | ( | serial_size_t | in_width,
|  | serial_size_t | in_height,
|  | serial_size_t | in_channels,
|  | serial_size_t | pooling_size,
|  | serial_size_t | stride
| ) |  |

inline

Parameters

  in_width | [in] width of input image
  in_height | [in] height of input image
  in_channels | [in] the number of input image channels(depth)
  pooling_size | [in] factor by which to upscale
  stride | [in] interval at which to apply the filters to the input

## Member Function Documentation

## back_propagation()

template<typename Activation = activation::identity>

void tiny_dnn::average_unpooling_layer< Activation >::back_propagation | ( | const std::vector< tensor_t * > & | in_data,
|  | const std::vector< tensor_t * > & | out_data,
|  | std::vector< tensor_t * > & | out_grad,
|  | std::vector< tensor_t * > & | in_grad
| ) |  |

inline override virtual

return delta of previous layer (delta=\frac{dE}{da}, a=wx in fully-connected layer)

Parameters

  in_data | input vectors (same vectors as forward_propagation)
  out_data | output vectors (same vectors as forward_propagation)
  out_grad | gradient of output vectors (i-th vector correspond with out_data[i])
  in_grad | gradient of input vectors (i-th vector correspond with in_data[i])

Implements tiny_dnn::layer.

## forward_propagation()

template<typename Activation = activation::identity>

void tiny_dnn::average_unpooling_layer< Activation >::forward_propagation | ( | const std::vector< tensor_t * > & | in_data,
|  | std::vector< tensor_t * > & | out_data
| ) |  |

inline override virtual

Parameters

  in_data | input vectors of this layer (data, weight, bias)
  out_data | output vectors

Implements tiny_dnn::layer.

## in_shape()

template<typename Activation = activation::identity>

std::vector< index3d< serial_size_t > > tiny_dnn::average_unpooling_layer< Activation >::in_shape | ( |  | ) | const

inline override virtual

array of input shapes (width x height x depth)

Implements tiny_dnn::layer.

## layer_type()

template<typename Activation = activation::identity>

std::string tiny_dnn::average_unpooling_layer< Activation >::layer_type | ( |  | ) | const

inline override virtual

name of layer, should be unique for each concrete class

Implements tiny_dnn::layer.

## out_shape()

template<typename Activation = activation::identity>

std::vector< index3d< serial_size_t > > tiny_dnn::average_unpooling_layer< Activation >::out_shape | ( |  | ) | const

inline override virtual

array of output shapes (width x height x depth)

Implements tiny_dnn::layer.

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

- tiny_dnn/layers/average_unpooling_layer.h