(self)
| 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: |
nothing calls this directly
no test coverage detected