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