MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / init_variables

Method init_variables

tensorflow/contrib/eager/python/metrics_impl.py:160–177  ·  view source on GitHub ↗

Initializes this Metric's variables. Should be called after variables are created in the first execution of `__call__()`. If using graph execution, the return value should be `run()` in a session before running the op returned by `__call__()`. (See example above.) Returns:

(self)

Source from the content-addressed store, hash-verified

158 return self._vars
159
160 def init_variables(self):
161 """Initializes this Metric's variables.
162
163 Should be called after variables are created in the first execution
164 of `__call__()`. If using graph execution, the return value should be
165 `run()` in a session before running the op returned by `__call__()`.
166 (See example above.)
167
168 Returns:
169 If using graph execution, this returns an op to perform the
170 initialization. Under eager execution, the variables are reset to their
171 initial values as a side effect and this function returns None.
172 """
173 if context.executing_eagerly():
174 for v in self._vars:
175 v.assign(self._initial_values[v])
176 else:
177 return control_flow_ops.group([v.initializer for v in self._vars])
178
179 # ---- To be implemented by descendants ---
180 def build(self, *args, **kwargs):

Callers

nothing calls this directly

Calls 3

executing_eagerlyMethod · 0.80
assignMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected