1 #include "caffe2/core/context.h" 2 #include "caffe2/core/operator.h" 3 #include "caffe2/utils/math.h" 14 const float* sum_multiplier,
17 math::RowwiseMax<float, CPUContext>(N, D, Xdata, rowmax, &context);
19 context.template CopyFromCPU<float>(N * D, Xdata, Ydata);
21 math::Gemm<float, CPUContext>(
34 math::Exp<float, CPUContext>(N * D, Ydata, Ydata, &context);
35 math::Gemv<float, CPUContext>(
36 CblasNoTrans, N, D, 1, Ydata, sum_multiplier, 0, scale, &context);
40 for (
int i = 0; i < N; ++i) {
41 for (
int j = 0; j < D; ++j) {
42 Ydata[i * D + j] /= scale[i];
46 for (
int i = 0; i < N; ++i) {
47 for (
int j = 0; j < D; ++j) {
49 Xdata[i * D + j] - rowmax[i] - log(fmaxf(scale[i], 1e-20f));
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...