clang format

fixstartbug
dongzhihong 8 years ago
parent 7945572cee
commit cf92472822

@ -45,19 +45,21 @@ class SoftmaxKernel : public framework::OpKernel {
Eigen::DSizes<int, 2> batch_by_one(batch_size, 1); Eigen::DSizes<int, 2> batch_by_one(batch_size, 1);
Eigen::DSizes<int, 2> one_by_class(1, num_classes); Eigen::DSizes<int, 2> one_by_class(1, num_classes);
auto shifted_logits = (logits - logits.maximum(along_class) auto shifted_logits = (logits -
.eval() logits.maximum(along_class)
.reshape(batch_by_one) .eval()
.broadcast(one_by_class)); .reshape(batch_by_one)
.broadcast(one_by_class));
softmax.device(context.GetEigenDevice<Place>()) = shifted_logits.exp(); softmax.device(context.GetEigenDevice<Place>()) = shifted_logits.exp();
softmax.device(context.GetEigenDevice<Place>()) = softmax.device(context.GetEigenDevice<Place>()) =
(softmax * softmax.sum(along_class) (softmax *
.inverse() softmax.sum(along_class)
.eval() .inverse()
.reshape(batch_by_one) .eval()
.broadcast(one_by_class)); .reshape(batch_by_one)
.broadcast(one_by_class));
} }
}; };

Loading…
Cancel
Save