(out)
| 281 | out_tensor /= corrected_n |
| 282 | |
| 283 | def _replace_nan(out): |
| 284 | indices = paddle.arange(out.numel(), dtype='int64') |
| 285 | out_nan = paddle.index_fill( |
| 286 | out.flatten(), indices, 0, float('nan') |
| 287 | ).reshape(out.shape) |
| 288 | return out_nan |
| 289 | |
| 290 | if 0 in x.shape: |
| 291 | out_tensor = _replace_nan(out_tensor) |