We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bcbb889 commit b5d6a16Copy full SHA for b5d6a16
python/paddle/tensor/to_string.py
@@ -252,6 +252,8 @@ def to_string(var, prefix='Tensor'):
252
return "Tensor(Not initialized)"
253
254
if var.dtype == paddle.bfloat16:
255
+ if not var.place.is_cpu_place():
256
+ paddle.device.synchronize()
257
var = var.astype('float32')
258
np_var = var.numpy(False)
259
@@ -297,6 +299,8 @@ def _format_dense_tensor(tensor, indent):
297
299
or dtype == core.VarDesc.VarType.FP8_E4M3FN
298
300
or dtype == core.VarDesc.VarType.FP8_E5M2
301
):
302
+ if not tensor.place.is_cpu_place():
303
304
tensor = tensor.astype('float32')
305
306
# TODO(zhouwei): will remove 0-D Tensor.numpy() hack
0 commit comments