MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / eval_model_multithread

Function eval_model_multithread

examples/A3C-Gym/common.py:104–114  ·  view source on GitHub ↗

Args: pred (OfflinePredictor): state -> [#action]

(pred, nr_eval, get_player_fn)

Source from the content-addressed store, hash-verified

102
103
104def eval_model_multithread(pred, nr_eval, get_player_fn):
105 """
106 Args:
107 pred (OfflinePredictor): state -> [#action]
108 """
109 NR_PROC = min(multiprocessing.cpu_count() // 2, 8)
110 with pred.sess.as_default():
111 mean, max = eval_with_funcs(
112 [pred] * NR_PROC, nr_eval,
113 get_player_fn, verbose=True)
114 logger.info("Average Score: {}; Max Score: {}".format(mean, max))
115
116
117class Evaluator(Callback):

Callers 1

train-atari.pyFile · 0.90

Calls 2

formatMethod · 0.80
eval_with_funcsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…