Skip to content
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

Do you plan to do a Pull Request on this? #3

Open
forresti opened this issue Jun 9, 2015 · 4 comments
Open

Do you plan to do a Pull Request on this? #3

forresti opened this issue Jun 9, 2015 · 4 comments

Comments

@forresti
Copy link

forresti commented Jun 9, 2015

It would be great to get batch normalization into the main branch of Caffe!

@swamiviv
Copy link

Sorry to barge in, I am having trouble with adding this layer in the newer version of caffe. I do as the wiki (s://github.com/BVLC/caffe/wiki/Development) tells me and I end up with this error:

src/caffe/layers/bn_layer.cpp: In instantiation of ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::Creator_BNLayer(const caffe::LayerParameter&) [with Dtype = float]’:
src/caffe/layers/bn_layer.cpp:276:2:   required from here
./include/caffe/layer_factory.hpp:121:67: error: cannot allocate an object of abstract type ‘caffe::BNLayer<float>’
     return shared_ptr<Layer<Dtype> >(new type##Layer<Dtype>(param));           \
                                                                   ^
src/caffe/layers/bn_layer.cpp:276:2: note: in expansion of macro ‘REGISTER_LAYER_CLASS’
  REGISTER_LAYER_CLASS(BN);
  ^
In file included from src/caffe/layers/bn_layer.cpp:4:0:
./include/caffe/common_layers.hpp:408:7: note:   because the following virtual functions are pure within ‘caffe::BNLayer<float>’:
 class BNLayer : public Layer<Dtype> {
       ^
In file included from ./include/caffe/data_layers.hpp:16:0,
                 from ./include/caffe/common_layers.hpp:10,
                 from src/caffe/layers/bn_layer.cpp:4:
./include/caffe/layer.hpp:100:16: note:     void caffe::Layer<Dtype>::Reshape(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = float]
   virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
                ^
./include/caffe/layer.hpp:304:16: note:     void caffe::Layer<Dtype>::Forward_cpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = float]
   virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
                ^
./include/caffe/layer.hpp:320:16: note:     void caffe::Layer<Dtype>::Backward_cpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<bool>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = float]
   virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
                ^
In file included from ./include/caffe/layer.hpp:10:0,
                 from ./include/caffe/data_layers.hpp:16,
                 from ./include/caffe/common_layers.hpp:10,
                 from src/caffe/layers/bn_layer.cpp:4:
src/caffe/layers/bn_layer.cpp: In instantiation of ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::Creator_BNLayer(const caffe::LayerParameter&) [with Dtype = double]’:
src/caffe/layers/bn_layer.cpp:276:2:   required from here
./include/caffe/layer_factory.hpp:121:67: error: cannot allocate an object of abstract type ‘caffe::BNLayer<double>’
     return shared_ptr<Layer<Dtype> >(new type##Layer<Dtype>(param));           \
                                                                   ^
src/caffe/layers/bn_layer.cpp:276:2: note: in expansion of macro ‘REGISTER_LAYER_CLASS’
  REGISTER_LAYER_CLASS(BN);
  ^
In file included from src/caffe/layers/bn_layer.cpp:4:0:
./include/caffe/common_layers.hpp:408:7: note:   because the following virtual functions are pure within ‘caffe::BNLayer<double>’:
 class BNLayer : public Layer<Dtype> {
       ^
In file included from ./include/caffe/data_layers.hpp:16:0,
                 from ./include/caffe/common_layers.hpp:10,
                 from src/caffe/layers/bn_layer.cpp:4:
./include/caffe/layer.hpp:100:16: note:     void caffe::Layer<Dtype>::Reshape(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = double]
   virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
                ^
./include/caffe/layer.hpp:304:16: note:     void caffe::Layer<Dtype>::Forward_cpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = double]
   virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
                ^
./include/caffe/layer.hpp:320:16: note:     void caffe::Layer<Dtype>::Backward_cpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<bool>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = double]
   virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,

Any ideas as to what's going on ?

@siddharthachandra
Copy link

Were you able to resolve this? I have the same issue. Thanks in advance.

@Elpidam
Copy link

Elpidam commented Dec 1, 2015

same here !!!!!!!!!!!!!
Actually I have created a layer "example_layer.cpp" and after doing all the appropriate steps I came up with this error

In instantiation of ‘boost::shared_ptrcaffe::Layer caffe::GetExampleLayer(const caffe::LayerParameter&) [with Dtype = double]’:
src/caffe/layer_factory.cpp:229:1: required from here
src/caffe/layer_factory.cpp:222:74: error: cannot allocate an object of abstract type ‘caffe::ExampleLayer’
return shared_ptr<Layer >(new ExampleLayer(param));

In layer_factory.cpp, I added:

template
shared_ptr<Layer > GetExampleLayer (const LayerParameter& param){
return shared_ptr<Layer >(new ExampleLayer(param));
}

REGISTER_LAYER_CREATOR(Example, GetExampleLayer);

@96imranahmed
Copy link

Did any of you guys manage to resolve this? This has been plaguing me all day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants