Skip to content

Commit e0e290a

Browse files
committed
add dtype covert for int_bincount
1 parent b5cf3c5 commit e0e290a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python/paddle/incubate/nn/functional/int_bincount.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
import paddle
1616
from paddle import _C_ops
1717
from paddle.base.data_feeder import convert_dtype
18-
from paddle.base.framework import in_dynamic_or_pir_mode
18+
from paddle.base.framework import (
19+
convert_np_dtype_to_dtype_,
20+
core,
21+
in_dynamic_or_pir_mode,
22+
)
1923
from paddle.base.layer_helper import LayerHelper
2024

2125

@@ -77,6 +81,9 @@ def math_int_bincount(x, low, high, dtype):
7781

7882
def int_bincount(x, low, high, dtype=None, name=None):
7983
if in_dynamic_or_pir_mode():
84+
if not isinstance(dtype, (core.VarDesc.VarType, core.DataType)):
85+
dtype = convert_np_dtype_to_dtype_(dtype)
86+
8087
if paddle.is_compiled_with_xpu():
8188
return math_int_bincount(x, low, high, dtype)
8289
else:

0 commit comments

Comments
 (0)