本文整理汇总了Python中tensorflow.python.summary.writer.writer.FileWriter方法的典型用法代码示例。如果您正苦于以下问题:Python writer.FileWriter方法的具体用法?Python writer.FileWriter怎么用?Python writer.FileWriter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorflow.python.summary.writer.writer
的用法示例。
在下文中一共展示了writer.FileWriter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __new__
# 需要导入模块: from tensorflow.python.summary.writer import writer [as 别名]
# 或者: from tensorflow.python.summary.writer.writer import FileWriter [as 别名]
def __new__(cls, logdir):
""" Creates a singleton instance.
Args:
logdir: A string, the directory for saving summaries.
Returns: The instance.
"""
assert logdir is not None and logdir != "", \
"need model_dir to initialize SummaryWriter"
if SummaryWriter.__instance is None:
SummaryWriter.__instance = super(
SummaryWriter, cls).__new__(cls)
fw = FileWriter(logdir, graph=ops.get_default_graph())
setattr(SummaryWriter.__instance, "_summary_writer", fw)
setattr(SummaryWriter.__instance, "add_graph", fw.add_graph)
setattr(SummaryWriter.__instance, "add_meta_graph", fw.add_meta_graph)
setattr(SummaryWriter.__instance, "add_session_log", fw.add_session_log)
return SummaryWriter.__instance
示例2: get
# 需要导入模块: from tensorflow.python.summary.writer import writer [as 别名]
# 或者: from tensorflow.python.summary.writer.writer import FileWriter [as 别名]
def get(logdir):
"""Returns the FileWriter for the specified directory.
Args:
logdir: str, name of the directory.
Returns:
A `FileWriter`.
"""
with FileWriterCache._lock:
if logdir not in FileWriterCache._cache:
FileWriterCache._cache[logdir] = FileWriter(
logdir, graph=ops.get_default_graph())
return FileWriterCache._cache[logdir]
示例3: install
# 需要导入模块: from tensorflow.python.summary.writer import writer [as 别名]
# 或者: from tensorflow.python.summary.writer.writer import FileWriter [as 别名]
def install(cls):
if cls._replaced_summary_writer:
raise ValueError('FakeSummaryWriter already installed.')
cls._replaced_summary_writer = writer.FileWriter
writer.FileWriter = FakeSummaryWriter
writer_cache.FileWriter = FakeSummaryWriter
示例4: uninstall
# 需要导入模块: from tensorflow.python.summary.writer import writer [as 别名]
# 或者: from tensorflow.python.summary.writer.writer import FileWriter [as 别名]
def uninstall(cls):
if not cls._replaced_summary_writer:
raise ValueError('FakeSummaryWriter not installed.')
writer.FileWriter = cls._replaced_summary_writer
writer_cache.FileWriter = cls._replaced_summary_writer
cls._replaced_summary_writer = None
示例5: get
# 需要导入模块: from tensorflow.python.summary.writer import writer [as 别名]
# 或者: from tensorflow.python.summary.writer.writer import FileWriter [as 别名]
def get(logdir):
"""Returns the SummaryWriter for the specified directory.
Args:
logdir: str, name of the directory.
Returns:
A `SummaryWriter`.
"""
with SummaryWriterCache._lock:
if logdir not in SummaryWriterCache._cache:
SummaryWriterCache._cache[logdir] = SummaryWriter(
logdir, graph=ops.get_default_graph())
return SummaryWriterCache._cache[logdir]