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

Method start_callback

lite/pylite/test/test_network.py:342–354  ·  view source on GitHub ↗
(ios)

Source from the content-addressed store, hash-verified

340 start_checked = False
341
342 def start_callback(ios):
343 nonlocal start_checked
344 start_checked = True
345 assert len(ios) == 1
346 for key in ios:
347 io = key
348 data = ios[key].to_numpy().flatten()
349 input_data = self.input_data.flatten()
350 assert data.size == input_data.size
351 assert io.name == "data"
352 for i in range(data.size):
353 assert abs(data[i] - input_data[i]) < 1e-5
354 return 0
355
356 network.set_start_callback(start_callback)
357 self.do_forward(network, 1)

Callers

nothing calls this directly

Calls 3

absFunction · 0.50
flattenMethod · 0.45
to_numpyMethod · 0.45

Tested by

no test coverage detected