# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sisyphus.gitbook.io/project/deep-learning-basics/deep-learning-debug/loss-jumps-to-87.3365.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
