Skip to content

Commit

Permalink
ohem for 2d softmax
Browse files Browse the repository at this point in the history
  • Loading branch information
ijkguo committed Aug 5, 2016
1 parent 3954709 commit 675ffaa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/operator/softmax_output-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ class SoftmaxOutputOp : public Operator {
valid_cnt = 1;
}
grad *= DType(param_.grad_scale / valid_cnt);
if (param_.is_hidden_layer) {
Tensor<xpu, 2, DType> o_grad =
out_grad[softmaxout_enum::kOut].get_with_shape<xpu, 2, DType>(s2, s);
grad *= o_grad;
}
}
}

Expand Down

0 comments on commit 675ffaa

Please sign in to comment.