本文整理汇总了Python中tensorflow.python.training.session_run_hook.SessionRunValues方法的典型用法代码示例。如果您正苦于以下问题:Python session_run_hook.SessionRunValues方法的具体用法?Python session_run_hook.SessionRunValues怎么用?Python session_run_hook.SessionRunValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorflow.python.training.session_run_hook
的用法示例。
在下文中一共展示了session_run_hook.SessionRunValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from tensorflow.python.training import session_run_hook [as 别名]
# 或者: from tensorflow.python.training.session_run_hook import SessionRunValues [as 别名]
def run(self, fetches, feed_dict=None, options=None, run_metadata=None):
"""See base class."""
if self.should_stop():
raise RuntimeError('Run called even after should_stop requested.')
actual_fetches = {'caller': fetches}
run_context = session_run_hook.SessionRunContext(
original_args=session_run_hook.SessionRunArgs(fetches, feed_dict),
session=self._sess)
options = options or config_pb2.RunOptions()
feed_dict = self._call_hook_before_run(run_context, actual_fetches,
feed_dict, options)
# Do session run.
run_metadata = run_metadata or config_pb2.RunMetadata()
outputs = _WrappedSession.run(self,
fetches=actual_fetches,
feed_dict=feed_dict,
options=options,
run_metadata=run_metadata)
for hook in self._hooks:
hook.after_run(
run_context,
session_run_hook.SessionRunValues(
results=outputs[hook] if hook in outputs else None,
options=options,
run_metadata=run_metadata))
self._should_stop = self._should_stop or run_context.stop_requested
return outputs['caller']
示例2: run
# 需要导入模块: from tensorflow.python.training import session_run_hook [as 别名]
# 或者: from tensorflow.python.training.session_run_hook import SessionRunValues [as 别名]
def run(self, fetches, feed_dict=None, options=None, run_metadata=None):
"""See base class."""
if self.should_stop():
raise RuntimeError('Run called even after should_stop requested.')
actual_fetches = {'caller': fetches}
run_context = session_run_hook.SessionRunContext(
original_args=session_run_hook.SessionRunArgs(fetches, feed_dict),
session=self._sess)
feed_dict = self._call_hook_before_run(
run_context, actual_fetches, feed_dict)
# Do session run.
outputs = _WrappedSession.run(self,
fetches=actual_fetches,
feed_dict=feed_dict,
options=options,
run_metadata=run_metadata)
for hook in self._hooks:
hook.after_run(
run_context,
session_run_hook.SessionRunValues(results=outputs[hook] if
hook in outputs else None))
self._should_stop = self._should_stop or run_context.stop_requested
return outputs['caller']