w4a8 offline (#3074)

* w4a8 offline

* update

* update

* update
This commit is contained in:
bukejiyu
2025-07-30 16:33:30 +08:00
committed by GitHub
parent 5acde4eb43
commit 8e203666d9
3 changed files with 215 additions and 0 deletions

View File

@@ -117,6 +117,9 @@ def get_tensor(input: Union[paddle.Tensor, np.ndarray, str], model_path=None) ->
paddle.Tensor: Returns a PaddlePaddle tensor.
"""
if "PySafeSlice" in str(type(input)):
input = input.get()
if isinstance(input, paddle.Tensor):
if input.place.is_cpu_place():
return input.to(paddle.device.get_device())