Add missing value support to SoftmaxLossLayer

This PR adds an option, `missing_value`, which allows some specified label to indicate that loss should not be computed at the corresponding location.

This creates an issue for normalization. To match the existing normalization, we should normalize by the number of labels actually present. However, this means that the weight of each label depends on the number of missing values in each batch, which may be undesirable. For this reason an extra boolean, `normalize`, is added; if `normalize` is false, normalization occurs only over the batch size.

Ideally this would be done in a way that can be used uniformly across different loss layers, but this is the form it exists in now.

Not yet well tested.
For `int` the default value is `0`

Sergio

2014-12-30 13:56 GMT-08:00 Jon Long <notifications@github.com>:

> In src/caffe/layers/softmax_loss_layer.cpp
> <https://github.com/BVLC/caffe/pull/1654#discussion-diff-22366612>:
>
> > @@ -17,6 +17,11 @@ void SoftmaxWithLossLayer<Dtype>::LayerSetUp(
> >    softmax_top_vec_.clear();
> >    softmax_top_vec_.push_back(&prob_);
> >    softmax_layer_->SetUp(softmax_bottom_vec_, softmax_top_vec_);
> > +
> > +  has_missing_values_ =
> > +    this->layer_param_.softmax_loss_param().has_missing_value();
> > +  missing_value_ = this->layer_param_.softmax_loss_param().missing_value();
>
> Yes, it's safe, see
> https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#fields
> and https://developers.google.com/protocol-buffers/docs/proto#optional.
> It might be a good idea to add a comment to make this clear.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/BVLC/caffe/pull/1654/files#r22366612>.
>