Skip to content
Merged
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
13 changes: 12 additions & 1 deletion python/paddle/tensor/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,17 @@ def concat(
input = [t for t in input if t.shape.count(0) == 0]
return _C_ops.concat(input, axis)
elif in_pir_mode():

def is_in_amp_mode():
amp_attrs = core._get_amp_attrs()
amp_level = amp_attrs._amp_level
apply_amp_level_list = [
core.AmpLevel.O1,
core.AmpLevel.O2,
]
return amp_level in apply_amp_level_list

is_in_amp = is_in_amp_mode()
check_type(input, 'input', (list, tuple, paddle.pir.Value), 'concat')
if not isinstance(input, paddle.pir.Value):
for id, x in enumerate(input):
Expand All @@ -1397,7 +1408,7 @@ def concat(
],
'concat',
)
if x.dtype != input[0].dtype:
if (not is_in_amp) and x.dtype != input[0].dtype:
raise TypeError(
"All the Tensors in the input must have the same data type."
)
Expand Down