Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanyonggong committed Dec 25, 2024
1 parent 97e1610 commit 05091af
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/paddle/tensorrt/impls/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ def cumsum_converter(network, paddle_op, inputs):
input_sliced.set_input(2, slice_shape)

# squeeze axis
shape_list.pop(axis)
if rank > 1:
shape_list.pop(axis)
new_shape = network.add_concatenation(shape_list).get_output(0)
squeeze_layer = network.add_shuffle(input_sliced.get_output(0))
squeeze_layer.set_input(1, new_shape)
Expand All @@ -301,6 +302,12 @@ def cumsum_converter(network, paddle_op, inputs):
lhs_val, cast_tensor, trt.ElementWiseOperation.PROD
).get_output(0)

# Set as scalar
if rank == 1:
shuffle_layer = network.add_shuffle(zero_tensor)
shuffle_layer.reshape_dims = trt.Dims()
zero_tensor = shuffle_layer.get_output(0)

# Cycle and add according to the axis
running_sum = loop.add_recurrence(zero_tensor)
running_sum_tensor = running_sum.get_output(0)
Expand Down

0 comments on commit 05091af

Please sign in to comment.