diff --git a/paddle/phi/kernels/gpu/check_numerics_kernel.cu b/paddle/phi/kernels/gpu/check_numerics_kernel.cu index 3238d3ece24789e849a4c8a09e71a2f57dbbb2a4..4b516b1074ba5a43196f020195f4d872a2f2e354 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);