Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def stable_softmax(x):
return exps / np.sum(exps)


def log_softmax(x, axis=-1):
def log_softmax(x, axis=1):
softmax_out = np.apply_along_axis(stable_softmax, axis, x)
return np.log(softmax_out)

Expand Down
2 changes: 1 addition & 1 deletion python/paddle/nn/functional/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ def cross_entropy(input,
" 'none', but received %s, which is not allowed." % reduction)

#step 1. log_softmax
log_softmax_out = paddle.nn.functional.log_softmax(input)
log_softmax_out = paddle.nn.functional.log_softmax(input, axis=1)
if weight is not None and not isinstance(weight, Variable):
raise ValueError(
"The weight' is not a Variable, please convert to Variable.")
Expand Down