I believe that there are three options for solving this problem.
1. Add your own layer Softmaxwith a temperature parameter. It should be pretty simple to change the code softmax_layer.cppto take into account the "temperature" T. You may need to configure caffe.prototo enable parsing of a layer Softmaxwith an additional parameter.
2. Deploy the layer as a python level .
3. If you need only a direct passage, that is, “extraction of functions”, you can simply output the “top” layer before the softmax layer as functions and make softmax with the temperature outside the coffee in general.
4. Scale Softmax:
layer {
type: "Scale"
name: "temperature"
bottom: "zi"
top: "zi/T"
scale_param {
filler: { type: 'constant' value: 1/T }
}
param { lr_mult: 0 decay_mult: 0 }
}
layer {
type: "Softmax"
name: "prob"
bottom: "zi/T"
top: "pi"
}