MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / _make_full_if_none

Function _make_full_if_none

imperative/python/megengine/functional/nn.py:1536–1544  ·  view source on GitHub ↗
(x, value)

Source from the content-addressed store, hash-verified

1534 raise NotImplementedError("sync_batch_norm for ndim != 4")
1535
1536 def _make_full_if_none(x, value):
1537 if x is None:
1538 x = Const(value, inp.dtype, _device)
1539 (result,) = apply(builtin.Broadcast(), x, reduce_shape)
1540 return result
1541 elif x.ndim == 1:
1542 (result,) = apply(builtin.Reshape(), x, reduce_shape)
1543 return result
1544 return x
1545
1546 (
1547 syncbn_stage0,

Callers 1

sync_batch_normFunction · 0.85

Calls 4

BroadcastMethod · 0.80
ReshapeMethod · 0.80
ConstClass · 0.50
applyFunction · 0.50

Tested by

no test coverage detected