本文整理匯總了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]