ConvNet  1.0
A GPU-based C++ implementation of Convolutional Neural Nets
 All Classes Namespaces Functions Variables
local_edge.h
1 #ifndef LOCAL_EDGE_H_
2 #define LOCAL_EDGE_H_
3 #include "edge_with_weight.h"
4 
6 class LocalEdge : public EdgeWithWeight {
7  public:
8  LocalEdge(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 
18  virtual int GetNumModules() const { return num_modules_; }
19  virtual void SetImageSize(int image_size);
20 
21  int GetKernelSize() const { return kernel_size_; }
22  int GetStride() const { return stride_; }
23  int GetPadding() const { return padding_; }
24 
25  private:
26  void AllocateMemoryBprop();
27  void AllocateMemoryFprop();
28 
29  int kernel_size_, stride_, padding_;
30 };
31 #endif
virtual void ComputeUp(Matrix &input, Matrix &output, bool overwrite)
Computes the output layer state given the input.
Definition: local_edge.cc:80
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: local_edge.cc:53
virtual int GetNumModules() const
Returns the number of modules.
Definition: local_edge.h:18
A GPU matrix class.
Definition: matrix.h:11
Implements a locally connected edge.
Definition: local_edge.h:6
virtual void ComputeOuter(Matrix &input, Matrix &deriv_output)
Computes the gradient for the weights and biases.
Definition: local_edge.cc:111
virtual void DisplayWeights()
Displays the weights.
Definition: local_edge.cc:19
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: local_edge.cc:95
virtual void SetImageSize(int image_size)
Set the spatial size of the input to this edge.
Definition: local_edge.cc:26
virtual void SetTiedTo(Edge *e)
Sets the edge to be tied to another edge.
Definition: local_edge.cc:11
Base class for all edges which have weights.
Definition: edge_with_weight.h:9