Skip to content
Merged
Changes from 1 commit
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
22 changes: 13 additions & 9 deletions python/paddle/tensor/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -4194,15 +4194,19 @@ def cumsum(
flatten = True
else:
flatten = False
if dtype is not None and x.dtype != convert_np_dtype_to_dtype_(dtype):
x = cast(x, dtype)
elif isinstance(x, paddle.Tensor) and x.dtype in [
paddle.uint8,
paddle.int8,
paddle.int16,
paddle.int32,
]:
x = cast(x, "int64")

if dtype is None:
if x.dtype in [
paddle.uint8,
paddle.int8,
paddle.int16,
paddle.int32,
]:
x = cast(x, "int64")
else:
dtype = convert_np_dtype_to_dtype_(dtype)
if x.dtype != dtype:
x = cast(x, dtype)

if in_dynamic_or_pir_mode():
if axis is None:
Expand Down
Loading