From b7fbd33991893bad7846615fa53159e6241052bd Mon Sep 17 00:00:00 2001 From: Yiqun Liu Date: Wed, 28 Jun 2023 10:44:21 +0800 Subject: [PATCH] Support 0-D Tensor for check_numerics_kernel. (#54868) --- paddle/phi/kernels/gpu/check_numerics_kernel.cu | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/phi/kernels/gpu/check_numerics_kernel.cu b/paddle/phi/kernels/gpu/check_numerics_kernel.cu index 3238d3ece24..4b516b1074b 100644 --- a/paddle/phi/kernels/gpu/check_numerics_kernel.cu +++ b/paddle/phi/kernels/gpu/check_numerics_kernel.cu @@ -496,10 +496,12 @@ void CheckNumericsKernel(const Context& ctx, DenseTensor* values) { int dev_id = tensor.place().device; VLOG(6) << "op_type=" << op_type << ", var_name=" << var_name - << ", dev_id=gpu:" << dev_id + << ", dev_id=gpu:" << dev_id << ", numel=" << tensor.numel() << ", stack_height_limit=" << stack_height_limit << ", output_dir=" << output_dir; + if (tensor.numel() <= 0) return; + // Print to the standard output. char* gpu_str_ptr = GetGpuHintStringPtr(ctx, op_type, var_name, dev_id); -- GitLab