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

Method before_run

tensorpack/callbacks/base.py:105–121  ·  view source on GitHub ↗
(self, ctx)

Source from the content-addressed store, hash-verified

103 pass
104
105 def before_run(self, ctx):
106 fetches = self._before_run(ctx)
107 if fetches is None:
108 return None
109 if isinstance(fetches, tf.train.SessionRunArgs):
110 return fetches
111
112 # also support list of names
113 assert isinstance(fetches, list), fetches
114 ret = []
115 for f in fetches:
116 if isinstance(f, (tf.Tensor, tf.Operation)):
117 ret.append(f)
118 else:
119 # warn about speed
120 ret.append(get_op_or_tensor_by_name(f))
121 return tf.train.SessionRunArgs(fetches=ret)
122
123 def _before_run(self, ctx):
124 """

Callers

nothing calls this directly

Calls 3

_before_runMethod · 0.95
get_op_or_tensor_by_nameFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected