fix doc. test=develop

revert-16555-model_data_cryption_link_all_lib
dengkaipeng 6 years ago
parent 40405d132c
commit 99369d43b6

@ -48,7 +48,7 @@ class KLDivLossOp : public framework::OperatorWithKernel {
if ("none" == reduction) {
ctx->SetOutputDim("Loss", dim_x);
} else {
ctx->SetOutputDim("Loss", framework::make_ddim({1}));
ctx->SetOutputDim("Loss", {1});
}
}
@ -81,7 +81,7 @@ class KLDivLossOpMaker : public framework::OpProtoAndCheckerMaker {
"The reduction type to apply to the output, available types "
"are 'none' | 'batchmean' | 'mean' | 'sum', 'none' for no "
"reduction, 'batchmean' for the sum of output divided by "
"batchmean size, 'mean' for the average valud of all output, "
"batch size, 'mean' for the average valud of all output, "
"'sum' for the sum of the output.")
.SetDefault("mean");

@ -104,7 +104,8 @@ class KLDivLossGradKernel : public framework::OpKernel<T> {
auto loss_grad_expand = loss_grad_t.broadcast(Array1(expand));
auto grad_t = target_t * loss_grad_expand;
input_grad_t.device(place) = target_t.binaryExpr(grad_t, KLDivLossBackward<T>());
input_grad_t.device(place) =
target_t.binaryExpr(grad_t, KLDivLossBackward<T>());
if ("mean" == reduction) {
input_grad_t.device(place) = input_grad_t / static_cast<T>(numel);

Loading…
Cancel
Save