> For the complete documentation index, see [llms.txt](https://sisyphus.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sisyphus.gitbook.io/project/deep-learning-basics/deep-learning-debug/loss-jumps-to-87.3365.md).

# Loss jumps to 87.3365

The id\_loss = 87.3365 usually means the softmax loss is computing -log(FLT\_MIN) [here](https://github.com/Cysu/caffe/blob/aed38841ae4282d90575186b87c3287620913722/src/caffe/layers/softmax_loss_layer.cu#L24-L25), which implies the probability is smaller than FLT\_MIN.However, this probability is computed as softmax(Wx), where W is initialized as [zero matrix](https://github.com/Cysu/caffe/blob/aed38841ae4282d90575186b87c3287620913722/src/caffe/layers/labeled_matching_layer.cpp#L32-L33) in the first iteration.

As I could not reproduce this situation on my machine, could you please kindly do me a favor by adding the following print function in caffe/src/caffe/layers/softmax\_loss\_layer.cu

```cpp
template <typename Dtype>
void debug_print(const Blob<Dtype>& prob) {
  printf("prob shape %d x %d\n", prob.shape(0), prob.shape(1));

  Dtype minval = (Dtype)FLT_MAX;
  Dtype maxval = -(Dtype)FLT_MAX;
  int minidx = 0;
  int maxidx = 0;

  const Dtype* data = prob.cpu_data();
  for (int i = 0; i < prob.count(); ++i) {
    if (data[i] <= minval) {
      minval = data[i];
      minidx = i;
    }
    if (data[i] >= maxval) {
      maxval = data[i];
      maxidx = i;
    }
  }

  printf("prob min = %.6f, at index %d\n", minval, minidx);
  printf("prob max = %.6f, at index %d\n", maxval, maxidx);
}
```

as well as adding debug\_print(prob\_);&#x20;

after [this line](https://github.com/Cysu/caffe/blob/aed38841ae4282d90575186b87c3287620913722/src/caffe/layers/softmax_loss_layer.cu#L34).Then recompile the caffe, rerun the experiments, and check the output before the Iteration 0. Thank you very much in advance.
