8000 Fix types of SetUp, Forward, Backward, and gradient checker calls by longjon · Pull Request #945 · BVLC/caffe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix types of SetUp, Forward, Backward, and gradient checker calls #945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 57 additions & 57 deletions include/caffe/common_layers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class ArgMaxLayer : public Layer<Dtype> {
explicit ArgMaxLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_ARGMAX;
Expand All @@ -62,10 +62,10 @@ class ArgMaxLayer : public Layer<Dtype> {
* @f$ (for @f$ K = 1 @f$).
*/
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
/// @brief Not implemented (non-differentiable function)
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom) {
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) {
NOT_IMPLEMENTED;
}
bool out_max_val_;
Expand All @@ -82,9 +82,9 @@ class ConcatLayer : public Layer<Dtype> {
explicit ConcatLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_CONCAT;
Expand All @@ -110,9 +110,9 @@ class ConcatLayer : public Layer<Dtype> {
* @f$
*/
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

/**
* @brief Computes the error gradient w.r.t. the concatenate inputs.
Expand All @@ -137,9 +137,9 @@ class ConcatLayer : public Layer<Dtype> {
* @f$
*/
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);

Blob<Dtype> col_bob_;
int count_;
Expand All @@ -162,9 +162,9 @@ class EltwiseLayer : public Layer<Dtype> {
explicit EltwiseLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_ELTWISE;
Expand All @@ -174,13 +174,13 @@ class EltwiseLayer : public Layer<Dtype> {

protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);

EltwiseParameter_EltwiseOp op_;
vector<Dtype> coeffs_;
Expand All @@ -205,7 +205,7 @@ class FlattenLayer : public Layer<Dtype> {
explicit FlattenLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_FLATTEN;
Expand All @@ -223,9 +223,9 @@ class FlattenLayer : public Layer<Dtype> {
* the outputs -- i.e., the (virtually) copied, flattened inputs
*/
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

/**
* @brief Computes the error gradient w.r.t. the concatenate inputs.
Expand All @@ -237,9 +237,9 @@ class FlattenLayer : public Layer<Dtype> {
* gradient is (virtually) copied
*/
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);

int count_;
};
Expand All @@ -256,9 +256,9 @@ class InnerProductLayer : public Layer<Dtype> {
explicit InnerProductLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_INNER_PRODUCT;
Expand All @@ -268,13 +268,13 @@ class InnerProductLayer : public Layer<Dtype> {

protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);

int M_;
int K_;
Expand All @@ -294,7 +294,7 @@ class MVNLayer : public Layer<Dtype> {
explicit MVNLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_MVN;
Expand All @@ -304,13 +304,13 @@ class MVNLayer : public Layer<Dtype> {

protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);

Blob<Dtype> mean_, variance_, temp_;

Expand All @@ -328,7 +328,7 @@ class SilenceLayer : public Layer<Dtype> {
explicit SilenceLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top) {}
const vector<Blob<Dtype>*>& top) {}

virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_SILENCE;
Expand All @@ -338,15 +338,15 @@ class SilenceLayer : public Layer<Dtype> {

protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top) {}
const vector<Blob<Dtype>*>& top) {}
// We can't define Forward_gpu here, since STUB_GPU will provide
// its own definition for CPU_ONLY mode.
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
};

/**
Expand All @@ -360,7 +360,7 @@ class SoftmaxLayer : public Layer<Dtype> {
explicit SoftmaxLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_SOFTMAX;
Expand All @@ -370,13 +370,13 @@ class SoftmaxLayer : public Layer<Dtype> {

protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);

/// sum_multiplier is used to carry out sum using BLAS
Blob<Dtype> sum_multiplier_;
Expand All @@ -395,16 +395,16 @@ class CuDNNSoftmaxLayer : public SoftmaxLayer<Dtype> {
explicit CuDNNSoftmaxLayer(const LayerParameter& param)
: SoftmaxLayer<Dtype>(param) {}
virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual ~CuDNNSoftmaxLayer();

protected:
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);

cudnnHandle_t handle_;
cudnnTensor4dDescriptor_t bottom_desc_;
Expand All @@ -424,7 +424,7 @@ class SplitLayer : public Layer<Dtype> {
explicit SplitLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_SPLIT;
Expand All @@ -434,13 +434,13 @@ class SplitLayer : public Layer<Dtype> {

protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);

int count_;
};
Expand All @@ -457,9 +457,9 @@ class SliceLayer : public Layer<Dtype> {
explicit SliceLayer(const LayerParameter& param)
: Layer<Dtype>(param) {}
virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);

virtual inline LayerParameter_LayerType type() const {
return LayerParameter_LayerType_SLICE;
Expand All @@ -469,13 +469,13 @@ class SliceLayer : public Layer<Dtype> {

protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
const vector<Blob<Dtype>*>& top);
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom);
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);

Blob<Dtype> col_bob_;
int count_;
Expand Down
Loading
0