ConvNet  1.0
A GPU-based C++ implementation of Convolutional Neural Nets
 All Classes Namespaces Functions Variables
conv_edge.h
1 #ifndef CONV_EDGE_H_
2 #define CONV_EDGE_H_
3 #include "edge_with_weight.h"
4 
6 class ConvEdge : public EdgeWithWeight {
7  public:
8  ConvEdge(const config::Edge& edge_config);
9  virtual void AllocateMemory(bool fprop_only);
10  virtual void ComputeUp(Matrix& input, Matrix& output, bool overwrite);
11  virtual void ComputeDown(Matrix& deriv_output, Matrix& input,
12  Matrix& output, Matrix& deriv_input, bool overwrite);
13  virtual void ComputeOuter(Matrix& input, Matrix& deriv_output);
14 
15  virtual void SetTiedTo(Edge* e);
16  virtual void DisplayWeights();
17  virtual int GetNumModules() const { return num_modules_; }
18  virtual void SetImageSize(int image_size);
19 
20  int GetKernelSize() const { return kernel_size_; }
21  int GetStride() const { return stride_; }
22  int GetPadding() const { return padding_; }
23  int GetPartialSum() const { return partial_sum_; }
24  bool GetSharedBias() const { return shared_bias_; }
25 
26  private:
27  void AllocateMemoryBprop();
28  void AllocateMemoryFprop();
29 
30  Matrix grad_weights_partial_sum_;
31  int kernel_size_, stride_, padding_, partial_sum_;
32  bool shared_bias_;
33 };
34 #endif
virtual void SetTiedTo(Edge *e)
Sets the edge to be tied to another edge.
Definition: conv_edge.cc:13
virtual void SetImageSize(int image_size)
Set the spatial size of the input to this edge.
Definition: conv_edge.cc:25
virtual void ComputeOuter(Matrix &input, Matrix &deriv_output)
Computes the gradient for the weights and biases.
Definition: conv_edge.cc:159
virtual void DisplayWeights()
Displays the weights.
Definition: conv_edge.cc:40
This class is intended to be used as a base class for implementing edges.
Definition: edge.h:13
virtual void AllocateMemory(bool fprop_only)
Allocate memory for the model.
Definition: conv_edge.cc:47
virtual void ComputeUp(Matrix &input, Matrix &output, bool overwrite)
Computes the output layer state given the input.
Definition: conv_edge.cc:116
A GPU matrix class.
Definition: matrix.h:11
virtual void ComputeDown(Matrix &deriv_output, Matrix &input, Matrix &output, Matrix &deriv_input, bool overwrite)
Computes the derivative w.r.t the inputs of this edge given the derivative w.r.t the outputs of this ...
Definition: conv_edge.cc:138
virtual int GetNumModules() const
Returns the number of modules.
Definition: conv_edge.h:17
Implements a convolutional edge.
Definition: conv_edge.h:6
Base class for all edges which have weights.
Definition: edge_with_weight.h:9