native top_p_sampling (#2901)

This commit is contained in:
lifulll
2025-07-22 14:09:59 +08:00
committed by GitHub
parent 0eedbdaee0
commit 2c6a9e887e
14 changed files with 93 additions and 7 deletions

View File

@@ -63,7 +63,12 @@ class SiluAndMul(nn.Layer):
"""
super().__init__()
if current_platform.is_cuda() or current_platform.is_xpu() or current_platform.is_iluvatar():
if (
current_platform.is_cuda()
or current_platform.is_xpu()
or current_platform.is_iluvatar()
or current_platform.is_dcu()
):
self.forward = self.forward_cuda
elif current_platform.is_gcu():
self.forward = self.forward_gcu