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

BatchNorm with CUDNN doesn't take effect, so there are no scale factors in BatchNorm layers? #3

Open
WenzhMicrosoft opened this issue Jul 27, 2017 · 2 comments

Comments

@WenzhMicrosoft
Copy link

WenzhMicrosoft commented Jul 27, 2017

I found that CuDNNBatchNormLayer in your caffe branch ( https://github.com/Tongcheng/caffe ) is not registered as a Creator in layer_factory.cpp, But your BatchNorm Registered with REGISTER_LAYER_CLASS(BatchNorm);

An registered CuDNNBatchNormLayer seems like this:
BVLC/caffe@c9eda39#diff-6fe0622356ab61c001bcac36dd571e7d

So I guess the following setting wouldn't take affect, and there is no scale factors, and we need to add scale layers after each "BatchNorm" layer

    scale_filler {
      type: "constant"
      value: 1
    }
    bias_filler {
      type: "constant"
      value: 0
    }
    engine: CUDNN

@WenzhMicrosoft WenzhMicrosoft changed the title BatchNorm with CUDNN doesn't work, so there are no scale factors in BatchNorm layers BatchNorm with CUDNN doesn't work, so there are no scale factors in BatchNorm layers? Jul 27, 2017
@Tongcheng
Copy link
Owner

Hello @WenzhMicrosoft , I am not sure what is the question we are having, but my understanding is that during layer initialization, it only reads the configuration from NeuralNetwork's proto based on the caffe.proto. Therefore I think layer_factory should not matter.

@WenzhMicrosoft
Copy link
Author

WenzhMicrosoft commented Jul 27, 2017

Hi @Tongcheng, You specified "engine: CUDNN" in prototxt, I think the reason you specified this is because you want to use a CuDNNBatchNormLayer(Do you?), and it makes more sense if you use CuDNNBatchNormLayer because CuDNNBatchNormLayer actually is combination of BatchNormLayer and ScaleLayer, normally Caffe version of Neural Network need this ScaleLayer layer to implement the γ and β factor metioned in Batch normalization paper

This is an example: https://github.com/KaimingHe/deep-residual-networks/blob/master/prototxt/ResNet-50-deploy.prototxt

As what I said before. Caffe actually creates a BatchNormLayer without γ and β. Is this what you want?

@WenzhMicrosoft WenzhMicrosoft changed the title BatchNorm with CUDNN doesn't work, so there are no scale factors in BatchNorm layers? BatchNorm with CUDNN doesn't take effect, so there are no scale factors in BatchNorm layers? Jul 27, 2017
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

2 participants