MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / _replace_nan

Function _replace_nan

python/paddle/tensor/stat.py:283–288  ·  view source on GitHub ↗
(out)

Source from the content-addressed store, hash-verified

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)

Callers 1

varFunction · 0.70

Calls 4

floatFunction · 0.50
numelMethod · 0.45
reshapeMethod · 0.45
flattenMethod · 0.45

Tested by

no test coverage detected