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

Function test_bn_no_track_stat

imperative/python/test/integration/test_bn.py:82–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80
81
82def test_bn_no_track_stat():
83 nchannel = 3
84 m = BatchNorm2d(nchannel, track_running_stats=False)
85
86 gm = ad.GradManager().attach(m.parameters())
87 optim = optimizer.SGD(m.parameters(), lr=1.0)
88 optim.clear_grad()
89
90 data = tensor(np.random.random((6, nchannel, 2, 2)).astype("float32"))
91 with gm:
92 loss = m(data).sum()
93 gm.backward(loss)
94 optim.step()
95
96
97def test_bn_no_track_stat2():

Callers

nothing calls this directly

Calls 10

BatchNorm2dClass · 0.90
parametersMethod · 0.80
attachMethod · 0.45
GradManagerMethod · 0.45
SGDMethod · 0.45
clear_gradMethod · 0.45
astypeMethod · 0.45
sumMethod · 0.45
backwardMethod · 0.45
stepMethod · 0.45

Tested by

no test coverage detected