Skip to content

Commit

Permalink
fix some error
Browse files Browse the repository at this point in the history
  • Loading branch information
Difers committed Sep 21, 2023
1 parent 8bddb5c commit 49cda24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/paddle/nn/functional/activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,11 @@ def softmax(x, axis=-1, dtype=None, name=None):
[0.03205860, 0.08714432, 0.23688282, 0.64391426]]])
"""

if (dtype is not None) and (not isinstance(dtype, core.VarDesc.VarType)):
if (
(dtype is not None)
and (not isinstance(dtype, core.VarDesc.VarType))
and (not isinstance(dtype, core.DataType))
):
dtype = convert_np_dtype_to_dtype_(dtype)
if in_dynamic_or_pir_mode():
outs_cast = x if dtype is None else _C_ops.cast(x, dtype)
Expand Down
2 changes: 2 additions & 0 deletions test/mkldnn/test_softmax_mkldnn_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

from paddle.base import core

paddle.enable_static()


def stable_softmax(x):
"""Compute the softmax of vector x in a numerically stable way."""
Expand Down

0 comments on commit 49cda24

Please sign in to comment.