ConvNet  1.0
A GPU-based C++ implementation of Convolutional Neural Nets
 All Classes Namespaces Functions Variables
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EdgeWithWeight Class Reference

Base class for all edges which have weights. More...

#include <edge_with_weight.h>

Inheritance diagram for EdgeWithWeight:
Edge ConvEdge ConvOneToOneEdge FCEdge LocalEdge

Public Member Functions

 EdgeWithWeight (const config::Edge &edge_config)
 
virtual void Initialize ()
 Initialize the weights and biases. More...
 
virtual void SaveParameters (hid_t file)
 Write the weights and biases in an hdf5 file. More...
 
virtual void LoadParameters (hid_t file)
 Load the weights and biases from an hdf5 file. More...
 
virtual void LoadParameters (hid_t file, const string &edge_name)
 
virtual float GetRMSWeight ()
 Returns the root mean square weight value. More...
 
virtual void ReduceLearningRate (float factor)
 Reduce the learning rate by factor. More...
 
virtual bool HasNoParameters () const
 Returns whether the edge has any parameters. More...
 
virtual int GetNumModules () const
 Returns the number of modules. More...
 
virtual void DisplayWeights ()
 Displays the weights. More...
 
virtual void DisplayWeightStats ()
 Displays the statistics of the weights. More...
 
virtual void SetTiedTo (Edge *e)
 Sets the edge to be tied to another edge. More...
 
virtual void UpdateWeights ()
 Update the weights. More...
 
MatrixGetWeight ()
 
MatrixGetGradWeight ()
 
MatrixGetBias ()
 
MatrixGetGradBias ()
 
float GetDecayedEpsilon (float base_epsilon) const
 
float GetMomentum () const
 
virtual void InsertPolyak ()
 
virtual void BackupCurrent ()
 
virtual void LoadCurrentOnGPU ()
 
virtual void LoadPolyakOnGPU ()
 
- Public Member Functions inherited from Edge
 Edge (const config::Edge &edge_config)
 Instatntiate an Edge from the config. More...
 
virtual void AllocateMemory (bool fprop_only)
 Allocate memory for the model. More...
 
virtual void ComputeUp (Matrix &input, Matrix &output, bool overwrite)=0
 Computes the output layer state given the input. More...
 
virtual void ComputeDown (Matrix &deriv_output, Matrix &input, Matrix &output, Matrix &deriv_input, bool overwrite)=0
 Computes the derivative w.r.t the inputs of this edge given the derivative w.r.t the outputs of this edge. More...
 
virtual void ComputeOuter (Matrix &input, Matrix &deriv_output)
 Computes the gradient for the weights and biases. More...
 
virtual void SetImageSize (int image_size)
 Set the spatial size of the input to this edge. More...
 
bool IsBackPropBlocked () const
 Returns whether back prop is blocked through this edge. More...
 
void SetSource (Layer *source)
 
void SetDest (Layer *dest)
 
LayerGetSource ()
 
LayerGetDest ()
 
const string & GetSourceName ()
 
const string & GetDestName ()
 
const string & GetName ()
 
void SetInputChannels (int a)
 Set the number of input channels. More...
 
void SetOutputChannels (int a)
 Set the number of output channels. More...
 
void SetMark ()
 
bool HasMark ()
 
string GetTiedEdgeName ()
 
bool IsTied ()
 
int GetGPUId () const
 
void ComputeStart (Matrix &mat)
 
void ComputeEnd (Matrix &mat)
 

Protected Member Functions

void IncrementNumGradsReceived ()
 
int GetNumGradsReceived ()
 

Protected Attributes

Matrix weights_
 
Matrix grad_weights_
 
Matrix bias_
 
Matrix grad_bias_
 
Optimizer *const weight_optimizer_
 
Optimizer *const bias_optimizer_
 
EdgeWithWeighttied_edge_
 
vector< Matrixpolyak_weights_
 
vector< Matrixpolyak_bias_
 
Matrix weights_backup_
 
Matrix bias_backup_
 
const config::Edge::Initialization initialization_
 
const int polyak_queue_size_
 
int polyak_index_
 
bool polyak_queue_full_
 
const float init_wt_
 
const float init_bias_
 
const bool has_no_bias_
 
int num_grads_received_
 
int num_shares_
 
const float scale_gradients_
 
const string pretrained_model_
 
const string pretrained_edge_name_
 
- Protected Attributes inherited from Edge
Layersource_
 
Layerdest_
 The source layer for this edge. More...
 
const string source_node_
 The destination layer for this edge. More...
 
const string dest_node_
 
const string name_
 
const string tied_edge_name_
 
Edgetied_edge_
 
int num_input_channels_
 
int num_output_channels_
 
int image_size_
 
int num_modules_
 
bool mark_
 
const bool block_backprop_
 A marker. More...
 
const bool is_tied_
 
ImageDisplayerimg_display_
 
const int gpu_id_
 

Additional Inherited Members

- Static Public Member Functions inherited from Edge
static EdgeChooseEdgeClass (const config::Edge &edge_config)
 Selects the appropriate derived class for the edge config. More...
 

Detailed Description

Base class for all edges which have weights.

All edges which have trainable parameters should inherit from this class.

Member Function Documentation

void EdgeWithWeight::DisplayWeights ( )
virtual

Displays the weights.

Supportsinput layer weights only.

Reimplemented from Edge.

Reimplemented in ConvEdge, and LocalEdge.

void EdgeWithWeight::DisplayWeightStats ( )
virtual

Displays the statistics of the weights.

Reimplemented from Edge.

int EdgeWithWeight::GetNumModules ( ) const
virtual

Returns the number of modules.

This is relevant for convolution-like edges.

Reimplemented from Edge.

Reimplemented in LocalEdge, ConvEdge, and ConvOneToOneEdge.

float EdgeWithWeight::GetRMSWeight ( )
virtual

Returns the root mean square weight value.

Reimplemented from Edge.

bool EdgeWithWeight::HasNoParameters ( ) const
virtual

Returns whether the edge has any parameters.

Reimplemented from Edge.

void EdgeWithWeight::Initialize ( )
virtual

Initialize the weights and biases.

Reimplemented from Edge.

void EdgeWithWeight::LoadParameters ( hid_t  file)
virtual

Load the weights and biases from an hdf5 file.

Parameters
fileThe file handle. The file has been opened for reading. Do not close it.

Reimplemented from Edge.

void EdgeWithWeight::ReduceLearningRate ( float  factor)
virtual

Reduce the learning rate by factor.

Reimplemented from Edge.

void EdgeWithWeight::SaveParameters ( hid_t  file)
virtual

Write the weights and biases in an hdf5 file.

Parameters
fileThe file handle. The file has been opened for writing. Do not close it.

Reimplemented from Edge.

void EdgeWithWeight::SetTiedTo ( Edge e)
virtual

Sets the edge to be tied to another edge.

Reimplemented from Edge.

Reimplemented in ConvEdge, and LocalEdge.

void EdgeWithWeight::UpdateWeights ( )
virtual

Update the weights.

Reimplemented from Edge.


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