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

[bug] duplicate layer name with same shape weight #7043

Open
lzwhard opened this issue Nov 17, 2021 · 1 comment
Open

[bug] duplicate layer name with same shape weight #7043

lzwhard opened this issue Nov 17, 2021 · 1 comment

Comments

@lzwhard
Copy link

lzwhard commented Nov 17, 2021

template <typename Dtype>
void Net<Dtype>::CopyTrainedLayersFrom(const NetParameter& param) {
  int num_source_layers = param.layer_size();
  for (int i = 0; i < num_source_layers; ++i) {
    const LayerParameter& source_layer = param.layer(i);
    const string& source_layer_name = source_layer.name();
    int target_layer_id = 0;
    while (target_layer_id != layer_names_.size() &&
        layer_names_[target_layer_id] != source_layer_name) {
      ++target_layer_id;
    }

If the network has two layers with the same name, the weights of the two layers will be copied from the caffemodel to the first layer in turn. As a result, the weight of the first layer takes the weight of the second layer, and the second layer has no weight.

@TrevorBlythe
Copy link

Name them differently?

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