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

Method _setup_graph

tensorpack/callbacks/summary.py:43–59  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 self._train_op = train_op
42
43 def _setup_graph(self):
44 ops = [k.op for k in tf.get_collection(self._collection)]
45 if self._train_op is None:
46 logger.info("[MovingAverageSummary] {} operations in collection '{}' "
47 "will be run with session hooks.".format(len(ops), self._collection))
48
49 self.ema_op = tf.group(*ops, name='maintain_moving_average_summary')
50 self._fetch = tf.train.SessionRunArgs(fetches=self.ema_op)
51 else:
52 if isinstance(self._train_op, tf.Tensor):
53 self._train_op = self._train_op.op
54 if not isinstance(self._train_op, tf.Operation):
55 self._train_op = self.graph.get_operation_by_name(self._train_op)
56 self._train_op._add_control_inputs(ops)
57 logger.info("[MovingAverageSummary] {} operations in collection '{}'"
58 " will be run together with operation '{}'.".format(
59 len(ops), self._collection, self._train_op.name))
60
61 def _before_run(self, _):
62 if self._train_op is None:

Callers

nothing calls this directly

Calls 3

get_collectionMethod · 0.80
formatMethod · 0.80
groupMethod · 0.80

Tested by

no test coverage detected