MagmaDNN  1.0
c++NeuralNetworkFramework
fullyconnectedlayer.h
Go to the documentation of this file.
1 
9 #include <vector>
10 #include "layer/layer.h"
11 #include "tensor/tensor.h"
12 #include "compute/operation.h"
13 #include "compute/tensor_operations.h"
14 
15 namespace magmadnn {
16 namespace layer {
17 
18 template <typename T>
19 class FullyConnectedLayer : public Layer<T> {
20 public:
21  FullyConnectedLayer(op::Operation<T> *input, unsigned int hidden_units, bool use_bias=true);
22  virtual ~FullyConnectedLayer();
23 
24  virtual std::vector<op::Operation<T> *> get_weights();
25 
26  op::Operation<T> *get_weight() { return weights; }
27  op::Operation<T> *get_bias() { return bias; }
28 
29 protected:
30  void init();
31 
32  unsigned int hidden_units;
33  bool use_bias;
34 
35  Tensor<T> *weights_tensor;
36  Tensor<T> *bias_tensor;
37 
38  op::Operation<T> *weights;
39  op::Operation<T> *bias;
40 
41 };
42 
43 template <typename T>
44 FullyConnectedLayer<T>* fullyconnected(op::Operation<T> *input, unsigned int hidden_units, bool use_bias=true);
45 
46 } // layer
47 } // magmadnn
Definition: fullyconnectedlayer.h:19
Definition: addop.cpp:11
Definition: tensor.h:34
Definition: layer.h:18
Definition: operation.h:18