Skip to content

MVNLayer across_channels is broken #2017

@cdoersch

Description

@cdoersch

In MVNLayer's forward, there's lots of cases where there's a gemv between a num-by-dim matrix and sum_multiplier_. When across_channels is true, dim will be channels*width*height. Unfortunately for the gemv, sum_multiplier_ is only width*height, since it's created with

   sum_multiplier_.Reshape(1, 1,
      bottom[0]->height(), bottom[0]->width());
    Dtype* multiplier_data = sum_multiplier_.mutable_cpu_data();
    caffe_set(sum_multiplier_.count(), Dtype(1), multiplier_data);

Hence, the gemv multiplies the matrix by random garbage whenever this flag is active.

The fix is just to check for across_channels during init and, if it's true, initialize sum_multiplier to be channels*width*height With this fix at least forward() seems to work properly. Since I'm guessing that the layer hasn't been extensively tested with this flag enabled, somebody may want to test backward() too...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions