update readme
This commit is contained in:
@@ -43,7 +43,7 @@ In order to colorize your own video, it requires to extract the video frames, an
|
||||
- Place your video frames into one folder, _e.g._, `./sample_videos/v32_180`
|
||||
- Place your reference images into another folder, _e.g._, `./sample_videos/v32`
|
||||
|
||||
If you want to _automatically_ retrieve color images, you can try the retrieval algorithm from \[[1](https://github.com/hmmlillian/Gray-Image-Retrieval)\] which will retrieve similar images from the ImageNet dataset. Or you can try [this link](https://github.com/pochih/CBIR) on your own image database.
|
||||
If you want to _automatically_ retrieve color images, you can try the retrieval algorithm from [this link](https://github.com/hmmlillian/Gray-Image-Retrieval) which will retrieve similar images from the ImageNet dataset. Or you can try [this link](https://github.com/pochih/CBIR) on your own image database.
|
||||
|
||||
## Test
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
"""A module for visualization with tensorboard
|
||||
"""
|
||||
|
||||
from .record_writer import RecordWriter
|
||||
from .writer import FileWriter, SummaryWriter
|
||||
@@ -1,314 +0,0 @@
|
||||
import array
|
||||
|
||||
CRC_TABLE = (
|
||||
0x00000000,
|
||||
0xF26B8303,
|
||||
0xE13B70F7,
|
||||
0x1350F3F4,
|
||||
0xC79A971F,
|
||||
0x35F1141C,
|
||||
0x26A1E7E8,
|
||||
0xD4CA64EB,
|
||||
0x8AD958CF,
|
||||
0x78B2DBCC,
|
||||
0x6BE22838,
|
||||
0x9989AB3B,
|
||||
0x4D43CFD0,
|
||||
0xBF284CD3,
|
||||
0xAC78BF27,
|
||||
0x5E133C24,
|
||||
0x105EC76F,
|
||||
0xE235446C,
|
||||
0xF165B798,
|
||||
0x030E349B,
|
||||
0xD7C45070,
|
||||
0x25AFD373,
|
||||
0x36FF2087,
|
||||
0xC494A384,
|
||||
0x9A879FA0,
|
||||
0x68EC1CA3,
|
||||
0x7BBCEF57,
|
||||
0x89D76C54,
|
||||
0x5D1D08BF,
|
||||
0xAF768BBC,
|
||||
0xBC267848,
|
||||
0x4E4DFB4B,
|
||||
0x20BD8EDE,
|
||||
0xD2D60DDD,
|
||||
0xC186FE29,
|
||||
0x33ED7D2A,
|
||||
0xE72719C1,
|
||||
0x154C9AC2,
|
||||
0x061C6936,
|
||||
0xF477EA35,
|
||||
0xAA64D611,
|
||||
0x580F5512,
|
||||
0x4B5FA6E6,
|
||||
0xB93425E5,
|
||||
0x6DFE410E,
|
||||
0x9F95C20D,
|
||||
0x8CC531F9,
|
||||
0x7EAEB2FA,
|
||||
0x30E349B1,
|
||||
0xC288CAB2,
|
||||
0xD1D83946,
|
||||
0x23B3BA45,
|
||||
0xF779DEAE,
|
||||
0x05125DAD,
|
||||
0x1642AE59,
|
||||
0xE4292D5A,
|
||||
0xBA3A117E,
|
||||
0x4851927D,
|
||||
0x5B016189,
|
||||
0xA96AE28A,
|
||||
0x7DA08661,
|
||||
0x8FCB0562,
|
||||
0x9C9BF696,
|
||||
0x6EF07595,
|
||||
0x417B1DBC,
|
||||
0xB3109EBF,
|
||||
0xA0406D4B,
|
||||
0x522BEE48,
|
||||
0x86E18AA3,
|
||||
0x748A09A0,
|
||||
0x67DAFA54,
|
||||
0x95B17957,
|
||||
0xCBA24573,
|
||||
0x39C9C670,
|
||||
0x2A993584,
|
||||
0xD8F2B687,
|
||||
0x0C38D26C,
|
||||
0xFE53516F,
|
||||
0xED03A29B,
|
||||
0x1F682198,
|
||||
0x5125DAD3,
|
||||
0xA34E59D0,
|
||||
0xB01EAA24,
|
||||
0x42752927,
|
||||
0x96BF4DCC,
|
||||
0x64D4CECF,
|
||||
0x77843D3B,
|
||||
0x85EFBE38,
|
||||
0xDBFC821C,
|
||||
0x2997011F,
|
||||
0x3AC7F2EB,
|
||||
0xC8AC71E8,
|
||||
0x1C661503,
|
||||
0xEE0D9600,
|
||||
0xFD5D65F4,
|
||||
0x0F36E6F7,
|
||||
0x61C69362,
|
||||
0x93AD1061,
|
||||
0x80FDE395,
|
||||
0x72966096,
|
||||
0xA65C047D,
|
||||
0x5437877E,
|
||||
0x4767748A,
|
||||
0xB50CF789,
|
||||
0xEB1FCBAD,
|
||||
0x197448AE,
|
||||
0x0A24BB5A,
|
||||
0xF84F3859,
|
||||
0x2C855CB2,
|
||||
0xDEEEDFB1,
|
||||
0xCDBE2C45,
|
||||
0x3FD5AF46,
|
||||
0x7198540D,
|
||||
0x83F3D70E,
|
||||
0x90A324FA,
|
||||
0x62C8A7F9,
|
||||
0xB602C312,
|
||||
0x44694011,
|
||||
0x5739B3E5,
|
||||
0xA55230E6,
|
||||
0xFB410CC2,
|
||||
0x092A8FC1,
|
||||
0x1A7A7C35,
|
||||
0xE811FF36,
|
||||
0x3CDB9BDD,
|
||||
0xCEB018DE,
|
||||
0xDDE0EB2A,
|
||||
0x2F8B6829,
|
||||
0x82F63B78,
|
||||
0x709DB87B,
|
||||
0x63CD4B8F,
|
||||
0x91A6C88C,
|
||||
0x456CAC67,
|
||||
0xB7072F64,
|
||||
0xA457DC90,
|
||||
0x563C5F93,
|
||||
0x082F63B7,
|
||||
0xFA44E0B4,
|
||||
0xE9141340,
|
||||
0x1B7F9043,
|
||||
0xCFB5F4A8,
|
||||
0x3DDE77AB,
|
||||
0x2E8E845F,
|
||||
0xDCE5075C,
|
||||
0x92A8FC17,
|
||||
0x60C37F14,
|
||||
0x73938CE0,
|
||||
0x81F80FE3,
|
||||
0x55326B08,
|
||||
0xA759E80B,
|
||||
0xB4091BFF,
|
||||
0x466298FC,
|
||||
0x1871A4D8,
|
||||
0xEA1A27DB,
|
||||
0xF94AD42F,
|
||||
0x0B21572C,
|
||||
0xDFEB33C7,
|
||||
0x2D80B0C4,
|
||||
0x3ED04330,
|
||||
0xCCBBC033,
|
||||
0xA24BB5A6,
|
||||
0x502036A5,
|
||||
0x4370C551,
|
||||
0xB11B4652,
|
||||
0x65D122B9,
|
||||
0x97BAA1BA,
|
||||
0x84EA524E,
|
||||
0x7681D14D,
|
||||
0x2892ED69,
|
||||
0xDAF96E6A,
|
||||
0xC9A99D9E,
|
||||
0x3BC21E9D,
|
||||
0xEF087A76,
|
||||
0x1D63F975,
|
||||
0x0E330A81,
|
||||
0xFC588982,
|
||||
0xB21572C9,
|
||||
0x407EF1CA,
|
||||
0x532E023E,
|
||||
0xA145813D,
|
||||
0x758FE5D6,
|
||||
0x87E466D5,
|
||||
0x94B49521,
|
||||
0x66DF1622,
|
||||
0x38CC2A06,
|
||||
0xCAA7A905,
|
||||
0xD9F75AF1,
|
||||
0x2B9CD9F2,
|
||||
0xFF56BD19,
|
||||
0x0D3D3E1A,
|
||||
0x1E6DCDEE,
|
||||
0xEC064EED,
|
||||
0xC38D26C4,
|
||||
0x31E6A5C7,
|
||||
0x22B65633,
|
||||
0xD0DDD530,
|
||||
0x0417B1DB,
|
||||
0xF67C32D8,
|
||||
0xE52CC12C,
|
||||
0x1747422F,
|
||||
0x49547E0B,
|
||||
0xBB3FFD08,
|
||||
0xA86F0EFC,
|
||||
0x5A048DFF,
|
||||
0x8ECEE914,
|
||||
0x7CA56A17,
|
||||
0x6FF599E3,
|
||||
0x9D9E1AE0,
|
||||
0xD3D3E1AB,
|
||||
0x21B862A8,
|
||||
0x32E8915C,
|
||||
0xC083125F,
|
||||
0x144976B4,
|
||||
0xE622F5B7,
|
||||
0xF5720643,
|
||||
0x07198540,
|
||||
0x590AB964,
|
||||
0xAB613A67,
|
||||
0xB831C993,
|
||||
0x4A5A4A90,
|
||||
0x9E902E7B,
|
||||
0x6CFBAD78,
|
||||
0x7FAB5E8C,
|
||||
0x8DC0DD8F,
|
||||
0xE330A81A,
|
||||
0x115B2B19,
|
||||
0x020BD8ED,
|
||||
0xF0605BEE,
|
||||
0x24AA3F05,
|
||||
0xD6C1BC06,
|
||||
0xC5914FF2,
|
||||
0x37FACCF1,
|
||||
0x69E9F0D5,
|
||||
0x9B8273D6,
|
||||
0x88D28022,
|
||||
0x7AB90321,
|
||||
0xAE7367CA,
|
||||
0x5C18E4C9,
|
||||
0x4F48173D,
|
||||
0xBD23943E,
|
||||
0xF36E6F75,
|
||||
0x0105EC76,
|
||||
0x12551F82,
|
||||
0xE03E9C81,
|
||||
0x34F4F86A,
|
||||
0xC69F7B69,
|
||||
0xD5CF889D,
|
||||
0x27A40B9E,
|
||||
0x79B737BA,
|
||||
0x8BDCB4B9,
|
||||
0x988C474D,
|
||||
0x6AE7C44E,
|
||||
0xBE2DA0A5,
|
||||
0x4C4623A6,
|
||||
0x5F16D052,
|
||||
0xAD7D5351,
|
||||
)
|
||||
|
||||
|
||||
CRC_INIT = 0
|
||||
|
||||
_MASK = 0xFFFFFFFF
|
||||
|
||||
|
||||
def crc_update(crc, data):
|
||||
"""Update CRC-32C checksum with data.
|
||||
|
||||
Args:
|
||||
crc: 32-bit checksum to update as long.
|
||||
data: byte array, string or iterable over bytes.
|
||||
|
||||
Returns:
|
||||
32-bit updated CRC-32C as long.
|
||||
"""
|
||||
|
||||
if type(data) != array.array or data.itemsize != 1:
|
||||
buf = array.array("B", data)
|
||||
else:
|
||||
buf = data
|
||||
|
||||
crc ^= _MASK
|
||||
for b in buf:
|
||||
table_index = (crc ^ b) & 0xFF
|
||||
crc = (CRC_TABLE[table_index] ^ (crc >> 8)) & _MASK
|
||||
return crc ^ _MASK
|
||||
|
||||
|
||||
def crc_finalize(crc):
|
||||
"""Finalize CRC-32C checksum.
|
||||
|
||||
This function should be called as last step of crc calculation.
|
||||
|
||||
Args:
|
||||
crc: 32-bit checksum as long.
|
||||
|
||||
Returns:
|
||||
finalized 32-bit checksum as long
|
||||
"""
|
||||
return crc & _MASK
|
||||
|
||||
|
||||
def crc32c(data):
|
||||
"""Compute CRC-32C checksum of the data.
|
||||
|
||||
Args:
|
||||
data: byte array, string or iterable over bytes.
|
||||
|
||||
Returns:
|
||||
32-bit CRC-32C checksum of data as long.
|
||||
"""
|
||||
return crc_finalize(crc_update(CRC_INIT, data))
|
||||
@@ -1,52 +0,0 @@
|
||||
import os
|
||||
|
||||
|
||||
def make_tsv(metadata, save_path):
|
||||
metadata = [str(x) for x in metadata]
|
||||
with open(os.path.join(save_path, "metadata.tsv"), "w") as f:
|
||||
for x in metadata:
|
||||
f.write(x + "\n")
|
||||
|
||||
|
||||
# https://github.com/tensorflow/tensorboard/issues/44 image label will be squared
|
||||
def make_sprite(label_img, save_path):
|
||||
import math
|
||||
|
||||
import torch
|
||||
import torchvision
|
||||
|
||||
from .x2num import makenp
|
||||
|
||||
# this ensures the sprite image has correct dimension as described in
|
||||
# https://www.tensorflow.org/get_started/embedding_viz
|
||||
nrow = int(math.ceil((label_img.size(0)) ** 0.5))
|
||||
|
||||
label_img = torch.from_numpy(makenp(label_img)) # for other framework
|
||||
# augment images so that #images equals nrow*nrow
|
||||
label_img = torch.cat((label_img, torch.randn(nrow ** 2 - label_img.size(0), *label_img.size()[1:]) * 255), 0)
|
||||
|
||||
torchvision.utils.save_image(label_img, os.path.join(save_path, "sprite.png"), nrow=nrow, padding=0)
|
||||
|
||||
|
||||
def append_pbtxt(metadata, label_img, save_path, global_step, tag):
|
||||
with open(os.path.join(save_path, "projector_config.pbtxt"), "a") as f:
|
||||
# step = os.path.split(save_path)[-1]
|
||||
f.write("embeddings {\n")
|
||||
f.write('tensor_name: "{}:{}"\n'.format(tag, global_step))
|
||||
f.write('tensor_path: "{}"\n'.format(os.path.join(global_step, "tensors.tsv")))
|
||||
if metadata is not None:
|
||||
f.write('metadata_path: "{}"\n'.format(os.path.join(global_step, "metadata.tsv")))
|
||||
if label_img is not None:
|
||||
f.write("sprite {\n")
|
||||
f.write('image_path: "{}"\n'.format(os.path.join(global_step, "sprite.png")))
|
||||
f.write("single_image_dim: {}\n".format(label_img.size(3)))
|
||||
f.write("single_image_dim: {}\n".format(label_img.size(2)))
|
||||
f.write("}\n")
|
||||
f.write("}\n")
|
||||
|
||||
|
||||
def make_mat(matlist, save_path):
|
||||
with open(os.path.join(save_path, "tensors.tsv"), "w") as f:
|
||||
for x in matlist:
|
||||
x = [str(i) for i in x]
|
||||
f.write("\t".join(x) + "\n")
|
||||
@@ -1,192 +0,0 @@
|
||||
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ==============================================================================
|
||||
"""Writes events to disk in a logdir."""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import logging
|
||||
import os.path
|
||||
import socket
|
||||
import threading
|
||||
import time
|
||||
|
||||
import six
|
||||
|
||||
from .record_writer import RecordWriter
|
||||
from .src import event_pb2
|
||||
|
||||
|
||||
def directory_check(path):
|
||||
"""Initialize the directory for log files."""
|
||||
# If the direcotry does not exist, create it!
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
|
||||
|
||||
class EventsWriter(object):
|
||||
"""Writes `Event` protocol buffers to an event file."""
|
||||
|
||||
def __init__(self, file_prefix):
|
||||
"""
|
||||
Events files have a name of the form
|
||||
'/some/file/path/events.out.tfevents.[timestamp].[hostname]'
|
||||
"""
|
||||
self._file_prefix = file_prefix + ".out.tfevents." + str(time.time())[:10] + "." + socket.gethostname()
|
||||
|
||||
# Open(Create) the log file with the particular form of name.
|
||||
logging.basicConfig(filename=self._file_prefix)
|
||||
|
||||
self._num_outstanding_events = 0
|
||||
|
||||
self._py_recordio_writer = RecordWriter(self._file_prefix)
|
||||
|
||||
# Initialize an event instance.
|
||||
self._event = event_pb2.Event()
|
||||
|
||||
self._event.wall_time = time.time()
|
||||
|
||||
self.write_event(self._event)
|
||||
|
||||
def write_event(self, event):
|
||||
"""Append "event" to the file."""
|
||||
|
||||
# Check if event is of type event_pb2.Event proto.
|
||||
if not isinstance(event, event_pb2.Event):
|
||||
raise TypeError("Expected an event_pb2.Event proto, " " but got %s" % type(event))
|
||||
return self._write_serialized_event(event.SerializeToString())
|
||||
|
||||
def _write_serialized_event(self, event_str):
|
||||
self._num_outstanding_events += 1
|
||||
self._py_recordio_writer.write(event_str)
|
||||
|
||||
def flush(self):
|
||||
"""Flushes the event file to disk."""
|
||||
self._num_outstanding_events = 0
|
||||
return True
|
||||
|
||||
def close(self):
|
||||
"""Call self.flush()."""
|
||||
return_value = self.flush()
|
||||
return return_value
|
||||
|
||||
|
||||
class EventFileWriter(object):
|
||||
"""Writes `Event` protocol buffers to an event file.
|
||||
The `EventFileWriter` class creates an event file in the specified directory,
|
||||
and asynchronously writes Event protocol buffers to the file. The Event file
|
||||
is encoded using the tfrecord format, which is similar to RecordIO.
|
||||
@@__init__
|
||||
@@add_event
|
||||
@@flush
|
||||
@@close
|
||||
"""
|
||||
|
||||
def __init__(self, logdir, max_queue=10, flush_secs=120):
|
||||
"""Creates a `EventFileWriter` and an event file to write to.
|
||||
On construction the summary writer creates a new event file in `logdir`.
|
||||
This event file will contain `Event` protocol buffers, which are written to
|
||||
disk via the add_event method.
|
||||
The other arguments to the constructor control the asynchronous writes to
|
||||
the event file:
|
||||
* `flush_secs`: How often, in seconds, to flush the added summaries
|
||||
and events to disk.
|
||||
* `max_queue`: Maximum number of summaries or events pending to be
|
||||
written to disk before one of the 'add' calls block.
|
||||
Args:
|
||||
logdir: A string. Directory where event file will be written.
|
||||
max_queue: Integer. Size of the queue for pending events and summaries.
|
||||
flush_secs: Number. How often, in seconds, to flush the
|
||||
pending events and summaries to disk.
|
||||
"""
|
||||
self._logdir = logdir
|
||||
directory_check(self._logdir)
|
||||
self._event_queue = six.moves.queue.Queue(max_queue)
|
||||
self._ev_writer = EventsWriter(os.path.join(self._logdir, "events"))
|
||||
self._closed = False
|
||||
self._worker = _EventLoggerThread(self._event_queue, self._ev_writer, flush_secs)
|
||||
|
||||
self._worker.start()
|
||||
|
||||
def get_logdir(self):
|
||||
"""Returns the directory where event file will be written."""
|
||||
return self._logdir
|
||||
|
||||
def reopen(self):
|
||||
"""Reopens the EventFileWriter.
|
||||
Can be called after `close()` to add more events in the same directory.
|
||||
The events will go into a new events file.
|
||||
Does nothing if the EventFileWriter was not closed.
|
||||
"""
|
||||
if self._closed:
|
||||
self._closed = False
|
||||
|
||||
def add_event(self, event):
|
||||
"""Adds an event to the event file.
|
||||
Args:
|
||||
event: An `Event` protocol buffer.
|
||||
"""
|
||||
if not self._closed:
|
||||
self._event_queue.put(event)
|
||||
|
||||
def flush(self):
|
||||
"""Flushes the event file to disk.
|
||||
Call this method to make sure that all pending events have been written to
|
||||
disk.
|
||||
"""
|
||||
self._event_queue.join()
|
||||
self._ev_writer.flush()
|
||||
|
||||
def close(self):
|
||||
"""Flushes the event file to disk and close the file.
|
||||
Call this method when you do not need the summary writer anymore.
|
||||
"""
|
||||
self.flush()
|
||||
self._ev_writer.close()
|
||||
self._closed = True
|
||||
|
||||
|
||||
class _EventLoggerThread(threading.Thread):
|
||||
"""Thread that logs events."""
|
||||
|
||||
def __init__(self, queue, ev_writer, flush_secs):
|
||||
"""Creates an _EventLoggerThread.
|
||||
Args:
|
||||
queue: A Queue from which to dequeue events.
|
||||
ev_writer: An event writer. Used to log brain events for
|
||||
the visualizer.
|
||||
flush_secs: How often, in seconds, to flush the
|
||||
pending file to disk.
|
||||
"""
|
||||
threading.Thread.__init__(self)
|
||||
self.daemon = True
|
||||
self._queue = queue
|
||||
self._ev_writer = ev_writer
|
||||
self._flush_secs = flush_secs
|
||||
# The first event will be flushed immediately.
|
||||
self._next_event_flush_time = 0
|
||||
|
||||
def run(self):
|
||||
while True:
|
||||
event = self._queue.get()
|
||||
try:
|
||||
self._ev_writer.write_event(event)
|
||||
# Flush the event writer every so often.
|
||||
now = time.time()
|
||||
if now > self._next_event_flush_time:
|
||||
self._ev_writer.flush()
|
||||
# Do it again in two minutes.
|
||||
self._next_event_flush_time = now + self._flush_secs
|
||||
finally:
|
||||
self._queue.task_done()
|
||||
@@ -1,73 +0,0 @@
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from .src.attr_value_pb2 import AttrValue
|
||||
from .src.graph_pb2 import GraphDef
|
||||
from .src.node_def_pb2 import NodeDef
|
||||
from .src.tensor_shape_pb2 import TensorShapeProto
|
||||
from .src.versions_pb2 import VersionDef
|
||||
|
||||
|
||||
def replace(name, scope):
|
||||
return "/".join([scope[name], name])
|
||||
|
||||
|
||||
def parse(graph):
|
||||
import torch
|
||||
|
||||
scope = {}
|
||||
for n in graph.nodes():
|
||||
inputs = [i.uniqueName() for i in n.inputs()]
|
||||
for i in range(1, len(inputs)):
|
||||
scope[inputs[i]] = n.scopeName()
|
||||
|
||||
uname = next(iter(n.outputs())).uniqueName()
|
||||
assert n.scopeName() != "", "{} has empty scope name".format(n)
|
||||
scope[uname] = n.scopeName()
|
||||
if LooseVersion(torch.__version__) >= LooseVersion("0.4"):
|
||||
scope["0"] = "input"
|
||||
else:
|
||||
scope["1"] = "input"
|
||||
|
||||
nodes = []
|
||||
for n in graph.nodes():
|
||||
attrs = {k: n[k] for k in n.attributeNames()}
|
||||
attrs = str(attrs).replace("'", " ") # singlequote will be escaped by tensorboard
|
||||
if any(i.uniqueName() not in scope.keys() for i in n.inputs()): # 0.3.1 workaround
|
||||
continue
|
||||
inputs = [replace(i.uniqueName(), scope) for i in n.inputs()]
|
||||
uname = next(iter(n.outputs())).uniqueName() # FIXME: only first output is considered
|
||||
nodes.append({"name": replace(uname, scope), "op": n.kind(), "inputs": inputs, "attr": attrs})
|
||||
|
||||
for n in graph.inputs():
|
||||
uname = n.uniqueName()
|
||||
if uname not in scope.keys():
|
||||
scope[uname] = "unused"
|
||||
nodes.append({"name": replace(uname, scope), "op": "Parameter", "inputs": [], "attr": str(n.type())})
|
||||
|
||||
return nodes
|
||||
|
||||
|
||||
def graph(model, args, verbose=False):
|
||||
import torch
|
||||
|
||||
with torch.onnx.set_training(model, False):
|
||||
trace, _ = torch.jit.trace(model, args)
|
||||
if LooseVersion(torch.__version__) >= LooseVersion("0.4"):
|
||||
torch.onnx._optimize_trace(trace, False)
|
||||
else:
|
||||
torch.onnx._optimize_trace(trace)
|
||||
graph = trace.graph()
|
||||
if verbose:
|
||||
print(graph)
|
||||
list_of_nodes = parse(graph)
|
||||
nodes = []
|
||||
for node in list_of_nodes:
|
||||
nodes.append(
|
||||
NodeDef(
|
||||
name=node["name"],
|
||||
op=node["op"],
|
||||
input=node["inputs"],
|
||||
attr={"lanpa": AttrValue(s=node["attr"].encode(encoding="utf_8"))},
|
||||
)
|
||||
)
|
||||
return GraphDef(node=nodes, versions=VersionDef(producer=22))
|
||||
@@ -1,159 +0,0 @@
|
||||
from .src.attr_value_pb2 import AttrValue
|
||||
from .src.graph_pb2 import GraphDef
|
||||
from .src.node_def_pb2 import NodeDef
|
||||
from .src.tensor_shape_pb2 import TensorShapeProto
|
||||
from .src.versions_pb2 import VersionDef
|
||||
|
||||
# from .src.onnx_pb2 import ModelProto
|
||||
|
||||
|
||||
def gg(fname):
|
||||
import onnx # 0.2.1
|
||||
|
||||
m = onnx.load(fname)
|
||||
nodes_proto = []
|
||||
nodes = []
|
||||
g = m.graph
|
||||
import itertools
|
||||
|
||||
for node in itertools.chain(g.input, g.output):
|
||||
nodes_proto.append(node)
|
||||
|
||||
for node in nodes_proto:
|
||||
shapeproto = TensorShapeProto(
|
||||
dim=[TensorShapeProto.Dim(size=d.dim_value) for d in node.type.tensor_type.shape.dim]
|
||||
)
|
||||
nodes.append(
|
||||
NodeDef(
|
||||
name=node.name,
|
||||
op="Variable",
|
||||
input=[],
|
||||
attr={"dtype": AttrValue(type=node.type.tensor_type.elem_type), "shape": AttrValue(shape=shapeproto),},
|
||||
)
|
||||
)
|
||||
|
||||
for node in g.node:
|
||||
attr = []
|
||||
for s in node.attribute:
|
||||
attr.append(" = ".join([str(f[1]) for f in s.ListFields()]))
|
||||
attr = ", ".join(attr).encode(encoding="utf_8")
|
||||
|
||||
nodes.append(
|
||||
NodeDef(name=node.output[0], op=node.op_type, input=node.input, attr={"parameters": AttrValue(s=attr)},)
|
||||
)
|
||||
# two pass token replacement, appends opname to object id
|
||||
mapping = {}
|
||||
for node in nodes:
|
||||
mapping[node.name] = node.op + "_" + node.name
|
||||
|
||||
nodes, mapping = updatenodes(nodes, mapping)
|
||||
mapping = smartGrouping(nodes, mapping)
|
||||
nodes, mapping = updatenodes(nodes, mapping)
|
||||
|
||||
return GraphDef(node=nodes, versions=VersionDef(producer=22))
|
||||
|
||||
|
||||
def updatenodes(nodes, mapping):
|
||||
for node in nodes:
|
||||
newname = mapping[node.name]
|
||||
node.name = newname
|
||||
newinput = []
|
||||
for inputnode in list(node.input):
|
||||
newinput.append(mapping[inputnode])
|
||||
node.input.remove(inputnode)
|
||||
node.input.extend(newinput)
|
||||
newmap = {}
|
||||
for k, v in mapping.items():
|
||||
newmap[v] = v
|
||||
return nodes, newmap
|
||||
|
||||
|
||||
def findnode(nodes, name):
|
||||
""" input: node name
|
||||
returns: node object
|
||||
"""
|
||||
for n in nodes:
|
||||
if n.name == name:
|
||||
return n
|
||||
|
||||
|
||||
def parser(s, nodes, node):
|
||||
print(s)
|
||||
if len(s) == 0:
|
||||
return
|
||||
if len(s) > 0:
|
||||
if s[0] == node.op:
|
||||
print(s[0], node.name, s[1], node.input)
|
||||
for n in node.input:
|
||||
print(n, s[1])
|
||||
parser(s[1], nodes, findnode(nodes, n))
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
# TODO: use recursive parse
|
||||
|
||||
|
||||
def smartGrouping(nodes, mapping):
|
||||
# a Fully Conv is: (TODO: check var1.size(0)==var2.size(0))
|
||||
# GEMM <-- Variable (c1)
|
||||
# ^-- Transpose (c2) <-- Variable (c3)
|
||||
|
||||
# a Conv with bias is: (TODO: check var1.size(0)==var2.size(0))
|
||||
# Add <-- Conv (c2) <-- Variable (c3)
|
||||
# ^-- Variable (c1)
|
||||
#
|
||||
# gemm = ('Gemm', ('Variable', ('Transpose', ('Variable'))))
|
||||
|
||||
FCcounter = 1
|
||||
Convcounter = 1
|
||||
for node in nodes:
|
||||
if node.op == "Gemm":
|
||||
c1 = c2 = c3 = False
|
||||
for name_in in node.input:
|
||||
n = findnode(nodes, name_in)
|
||||
if n.op == "Variable":
|
||||
c1 = True
|
||||
c1name = n.name
|
||||
if n.op == "Transpose":
|
||||
c2 = True
|
||||
c2name = n.name
|
||||
if len(n.input) == 1:
|
||||
nn = findnode(nodes, n.input[0])
|
||||
if nn.op == "Variable":
|
||||
c3 = True
|
||||
c3name = nn.name
|
||||
# print(n.op, n.name, c1, c2, c3)
|
||||
if c1 and c2 and c3:
|
||||
# print(c1name, c2name, c3name)
|
||||
mapping[c1name] = "FC{}/{}".format(FCcounter, c1name)
|
||||
mapping[c2name] = "FC{}/{}".format(FCcounter, c2name)
|
||||
mapping[c3name] = "FC{}/{}".format(FCcounter, c3name)
|
||||
mapping[node.name] = "FC{}/{}".format(FCcounter, node.name)
|
||||
FCcounter += 1
|
||||
continue
|
||||
if node.op == "Add":
|
||||
c1 = c2 = c3 = False
|
||||
for name_in in node.input:
|
||||
n = findnode(nodes, name_in)
|
||||
if n.op == "Variable":
|
||||
c1 = True
|
||||
c1name = n.name
|
||||
if n.op == "Conv":
|
||||
c2 = True
|
||||
c2name = n.name
|
||||
if len(n.input) >= 1:
|
||||
for nn_name in n.input:
|
||||
nn = findnode(nodes, nn_name)
|
||||
if nn.op == "Variable":
|
||||
c3 = True
|
||||
c3name = nn.name
|
||||
|
||||
if c1 and c2 and c3:
|
||||
# print(c1name, c2name, c3name)
|
||||
mapping[c1name] = "Conv{}/{}".format(Convcounter, c1name)
|
||||
mapping[c2name] = "Conv{}/{}".format(Convcounter, c2name)
|
||||
mapping[c3name] = "Conv{}/{}".format(Convcounter, c3name)
|
||||
mapping[node.name] = "Conv{}/{}".format(Convcounter, node.name)
|
||||
Convcounter += 1
|
||||
return mapping
|
||||
@@ -1,47 +0,0 @@
|
||||
"""
|
||||
To write tf_record into file. Here we use it for tensorboard's event writting.
|
||||
The code was borrow from https://github.com/TeamHG-Memex/tensorboard_logger
|
||||
"""
|
||||
|
||||
import re
|
||||
import struct
|
||||
|
||||
from .crc32c import crc32c
|
||||
|
||||
_VALID_OP_NAME_START = re.compile("^[A-Za-z0-9.]")
|
||||
_VALID_OP_NAME_PART = re.compile("[A-Za-z0-9_.\\-/]+")
|
||||
|
||||
|
||||
class RecordWriter(object):
|
||||
def __init__(self, path, flush_secs=2):
|
||||
self._name_to_tf_name = {}
|
||||
self._tf_names = set()
|
||||
self.path = path
|
||||
self.flush_secs = flush_secs # TODO. flush every flush_secs, not every time.
|
||||
self._writer = None
|
||||
self._writer = open(path, "wb")
|
||||
|
||||
def write(self, event_str):
|
||||
w = self._writer.write
|
||||
header = struct.pack("Q", len(event_str))
|
||||
w(header)
|
||||
w(struct.pack("I", masked_crc32c(header)))
|
||||
w(event_str)
|
||||
w(struct.pack("I", masked_crc32c(event_str)))
|
||||
self._writer.flush()
|
||||
|
||||
|
||||
def masked_crc32c(data):
|
||||
x = u32(crc32c(data))
|
||||
return u32(((x >> 15) | u32(x << 17)) + 0xA282EAD8)
|
||||
|
||||
|
||||
def u32(x):
|
||||
return x & 0xFFFFFFFF
|
||||
|
||||
|
||||
def make_valid_tf_name(name):
|
||||
if not _VALID_OP_NAME_START.match(name):
|
||||
# Must make it valid somehow, but don't want to remove stuff
|
||||
name = "." + name
|
||||
return "_".join(_VALID_OP_NAME_PART.findall(name))
|
||||
@@ -1,600 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/attr_value.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from tensorboardX.src import tensor_pb2 as tensorboardX_dot_src_dot_tensor__pb2
|
||||
from tensorboardX.src import tensor_shape_pb2 as tensorboardX_dot_src_dot_tensor__shape__pb2
|
||||
from tensorboardX.src import types_pb2 as tensorboardX_dot_src_dot_types__pb2
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/attr_value.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
"\n!tensorboardX/src/attr_value.proto\x12\x0btensorboard\x1a\x1dtensorboardX/src/tensor.proto\x1a#tensorboardX/src/tensor_shape.proto\x1a\x1ctensorboardX/src/types.proto\"\xaf\x04\n\tAttrValue\x12\x0b\n\x01s\x18\x02 \x01(\x0cH\x00\x12\x0b\n\x01i\x18\x03 \x01(\x03H\x00\x12\x0b\n\x01\x66\x18\x04 \x01(\x02H\x00\x12\x0b\n\x01\x62\x18\x05 \x01(\x08H\x00\x12%\n\x04type\x18\x06 \x01(\x0e\x32\x15.tensorboard.DataTypeH\x00\x12.\n\x05shape\x18\x07 \x01(\x0b\x32\x1d.tensorboard.TensorShapeProtoH\x00\x12*\n\x06tensor\x18\x08 \x01(\x0b\x32\x18.tensorboard.TensorProtoH\x00\x12\x30\n\x04list\x18\x01 \x01(\x0b\x32 .tensorboard.AttrValue.ListValueH\x00\x12)\n\x04\x66unc\x18\n \x01(\x0b\x32\x19.tensorboard.NameAttrListH\x00\x12\x15\n\x0bplaceholder\x18\t \x01(\tH\x00\x1a\xed\x01\n\tListValue\x12\t\n\x01s\x18\x02 \x03(\x0c\x12\r\n\x01i\x18\x03 \x03(\x03\x42\x02\x10\x01\x12\r\n\x01\x66\x18\x04 \x03(\x02\x42\x02\x10\x01\x12\r\n\x01\x62\x18\x05 \x03(\x08\x42\x02\x10\x01\x12'\n\x04type\x18\x06 \x03(\x0e\x32\x15.tensorboard.DataTypeB\x02\x10\x01\x12,\n\x05shape\x18\x07 \x03(\x0b\x32\x1d.tensorboard.TensorShapeProto\x12(\n\x06tensor\x18\x08 \x03(\x0b\x32\x18.tensorboard.TensorProto\x12'\n\x04\x66unc\x18\t \x03(\x0b\x32\x19.tensorboard.NameAttrListB\x07\n\x05value\"\x94\x01\n\x0cNameAttrList\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x31\n\x04\x61ttr\x18\x02 \x03(\x0b\x32#.tensorboard.NameAttrList.AttrEntry\x1a\x43\n\tAttrEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.tensorboard.AttrValue:\x02\x38\x01\x42\x30\n\x18org.tensorflow.frameworkB\x0f\x41ttrValueProtosP\x01\xf8\x01\x01\x62\x06proto3"
|
||||
),
|
||||
dependencies=[
|
||||
tensorboardX_dot_src_dot_tensor__pb2.DESCRIPTOR,
|
||||
tensorboardX_dot_src_dot_tensor__shape__pb2.DESCRIPTOR,
|
||||
tensorboardX_dot_src_dot_types__pb2.DESCRIPTOR,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
_ATTRVALUE_LISTVALUE = _descriptor.Descriptor(
|
||||
name="ListValue",
|
||||
full_name="tensorboard.AttrValue.ListValue",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="s",
|
||||
full_name="tensorboard.AttrValue.ListValue.s",
|
||||
index=0,
|
||||
number=2,
|
||||
type=12,
|
||||
cpp_type=9,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="i",
|
||||
full_name="tensorboard.AttrValue.ListValue.i",
|
||||
index=1,
|
||||
number=3,
|
||||
type=3,
|
||||
cpp_type=2,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="f",
|
||||
full_name="tensorboard.AttrValue.ListValue.f",
|
||||
index=2,
|
||||
number=4,
|
||||
type=2,
|
||||
cpp_type=6,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="b",
|
||||
full_name="tensorboard.AttrValue.ListValue.b",
|
||||
index=3,
|
||||
number=5,
|
||||
type=8,
|
||||
cpp_type=7,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="type",
|
||||
full_name="tensorboard.AttrValue.ListValue.type",
|
||||
index=4,
|
||||
number=6,
|
||||
type=14,
|
||||
cpp_type=8,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="shape",
|
||||
full_name="tensorboard.AttrValue.ListValue.shape",
|
||||
index=5,
|
||||
number=7,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="tensor",
|
||||
full_name="tensorboard.AttrValue.ListValue.tensor",
|
||||
index=6,
|
||||
number=8,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="func",
|
||||
full_name="tensorboard.AttrValue.ListValue.func",
|
||||
index=7,
|
||||
number=9,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=462,
|
||||
serialized_end=699,
|
||||
)
|
||||
|
||||
_ATTRVALUE = _descriptor.Descriptor(
|
||||
name="AttrValue",
|
||||
full_name="tensorboard.AttrValue",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="s",
|
||||
full_name="tensorboard.AttrValue.s",
|
||||
index=0,
|
||||
number=2,
|
||||
type=12,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b(""),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="i",
|
||||
full_name="tensorboard.AttrValue.i",
|
||||
index=1,
|
||||
number=3,
|
||||
type=3,
|
||||
cpp_type=2,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="f",
|
||||
full_name="tensorboard.AttrValue.f",
|
||||
index=2,
|
||||
number=4,
|
||||
type=2,
|
||||
cpp_type=6,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=float(0),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="b",
|
||||
full_name="tensorboard.AttrValue.b",
|
||||
index=3,
|
||||
number=5,
|
||||
type=8,
|
||||
cpp_type=7,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=False,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="type",
|
||||
full_name="tensorboard.AttrValue.type",
|
||||
index=4,
|
||||
number=6,
|
||||
type=14,
|
||||
cpp_type=8,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="shape",
|
||||
full_name="tensorboard.AttrValue.shape",
|
||||
index=5,
|
||||
number=7,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="tensor",
|
||||
full_name="tensorboard.AttrValue.tensor",
|
||||
index=6,
|
||||
number=8,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="list",
|
||||
full_name="tensorboard.AttrValue.list",
|
||||
index=7,
|
||||
number=1,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="func",
|
||||
full_name="tensorboard.AttrValue.func",
|
||||
index=8,
|
||||
number=10,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="placeholder",
|
||||
full_name="tensorboard.AttrValue.placeholder",
|
||||
index=9,
|
||||
number=9,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[_ATTRVALUE_LISTVALUE,],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
_descriptor.OneofDescriptor(
|
||||
name="value", full_name="tensorboard.AttrValue.value", index=0, containing_type=None, fields=[]
|
||||
),
|
||||
],
|
||||
serialized_start=149,
|
||||
serialized_end=708,
|
||||
)
|
||||
|
||||
|
||||
_NAMEATTRLIST_ATTRENTRY = _descriptor.Descriptor(
|
||||
name="AttrEntry",
|
||||
full_name="tensorboard.NameAttrList.AttrEntry",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="key",
|
||||
full_name="tensorboard.NameAttrList.AttrEntry.key",
|
||||
index=0,
|
||||
number=1,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="value",
|
||||
full_name="tensorboard.NameAttrList.AttrEntry.value",
|
||||
index=1,
|
||||
number=2,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b("8\001")),
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=792,
|
||||
serialized_end=859,
|
||||
)
|
||||
|
||||
_NAMEATTRLIST = _descriptor.Descriptor(
|
||||
name="NameAttrList",
|
||||
full_name="tensorboard.NameAttrList",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="name",
|
||||
full_name="tensorboard.NameAttrList.name",
|
||||
index=0,
|
||||
number=1,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="attr",
|
||||
full_name="tensorboard.NameAttrList.attr",
|
||||
index=1,
|
||||
number=2,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[_NAMEATTRLIST_ATTRENTRY,],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=711,
|
||||
serialized_end=859,
|
||||
)
|
||||
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["type"].enum_type = tensorboardX_dot_src_dot_types__pb2._DATATYPE
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name[
|
||||
"shape"
|
||||
].message_type = tensorboardX_dot_src_dot_tensor__shape__pb2._TENSORSHAPEPROTO
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["tensor"].message_type = tensorboardX_dot_src_dot_tensor__pb2._TENSORPROTO
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["func"].message_type = _NAMEATTRLIST
|
||||
_ATTRVALUE_LISTVALUE.containing_type = _ATTRVALUE
|
||||
_ATTRVALUE.fields_by_name["type"].enum_type = tensorboardX_dot_src_dot_types__pb2._DATATYPE
|
||||
_ATTRVALUE.fields_by_name["shape"].message_type = tensorboardX_dot_src_dot_tensor__shape__pb2._TENSORSHAPEPROTO
|
||||
_ATTRVALUE.fields_by_name["tensor"].message_type = tensorboardX_dot_src_dot_tensor__pb2._TENSORPROTO
|
||||
_ATTRVALUE.fields_by_name["list"].message_type = _ATTRVALUE_LISTVALUE
|
||||
_ATTRVALUE.fields_by_name["func"].message_type = _NAMEATTRLIST
|
||||
_ATTRVALUE.oneofs_by_name["value"].fields.append(_ATTRVALUE.fields_by_name["s"])
|
||||
_ATTRVALUE.fields_by_name["s"].containing_oneof = _ATTRVALUE.oneofs_by_name["value"]
|
||||
_ATTRVALUE.oneofs_by_name["value"].fields.append(_ATTRVALUE.fields_by_name["i"])
|
||||
_ATTRVALUE.fields_by_name["i"].containing_oneof = _ATTRVALUE.oneofs_by_name["value"]
|
||||
_ATTRVALUE.oneofs_by_name["value"].fields.append(_ATTRVALUE.fields_by_name["f"])
|
||||
_ATTRVALUE.fields_by_name["f"].containing_oneof = _ATTRVALUE.oneofs_by_name["value"]
|
||||
_ATTRVALUE.oneofs_by_name["value"].fields.append(_ATTRVALUE.fields_by_name["b"])
|
||||
_ATTRVALUE.fields_by_name["b"].containing_oneof = _ATTRVALUE.oneofs_by_name["value"]
|
||||
_ATTRVALUE.oneofs_by_name["value"].fields.append(_ATTRVALUE.fields_by_name["type"])
|
||||
_ATTRVALUE.fields_by_name["type"].containing_oneof = _ATTRVALUE.oneofs_by_name["value"]
|
||||
_ATTRVALUE.oneofs_by_name["value"].fields.append(_ATTRVALUE.fields_by_name["shape"])
|
||||
_ATTRVALUE.fields_by_name["shape"].containing_oneof = _ATTRVALUE.oneofs_by_name["value"]
|
||||
_ATTRVALUE.oneofs_by_name["value"].fields.append(_ATTRVALUE.fields_by_name["tensor"])
|
||||
_ATTRVALUE.fields_by_name["tensor"].containing_oneof = _ATTRVALUE.oneofs_by_name["value"]
|
||||
_ATTRVALUE.oneofs_by_name["value"].fields.append(_ATTRVALUE.fields_by_name["list"])
|
||||
_ATTRVALUE.fields_by_name["list"].containing_oneof = _ATTRVALUE.oneofs_by_name["value"]
|
||||
_ATTRVALUE.oneofs_by_name["value"].fields.append(_ATTRVALUE.fields_by_name["func"])
|
||||
_ATTRVALUE.fields_by_name["func"].containing_oneof = _ATTRVALUE.oneofs_by_name["value"]
|
||||
_ATTRVALUE.oneofs_by_name["value"].fields.append(_ATTRVALUE.fields_by_name["placeholder"])
|
||||
_ATTRVALUE.fields_by_name["placeholder"].containing_oneof = _ATTRVALUE.oneofs_by_name["value"]
|
||||
_NAMEATTRLIST_ATTRENTRY.fields_by_name["value"].message_type = _ATTRVALUE
|
||||
_NAMEATTRLIST_ATTRENTRY.containing_type = _NAMEATTRLIST
|
||||
_NAMEATTRLIST.fields_by_name["attr"].message_type = _NAMEATTRLIST_ATTRENTRY
|
||||
DESCRIPTOR.message_types_by_name["AttrValue"] = _ATTRVALUE
|
||||
DESCRIPTOR.message_types_by_name["NameAttrList"] = _NAMEATTRLIST
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
AttrValue = _reflection.GeneratedProtocolMessageType(
|
||||
"AttrValue",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
ListValue=_reflection.GeneratedProtocolMessageType(
|
||||
"ListValue",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_ATTRVALUE_LISTVALUE,
|
||||
__module__="tensorboardX.src.attr_value_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.AttrValue.ListValue)
|
||||
),
|
||||
),
|
||||
DESCRIPTOR=_ATTRVALUE,
|
||||
__module__="tensorboardX.src.attr_value_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.AttrValue)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(AttrValue)
|
||||
_sym_db.RegisterMessage(AttrValue.ListValue)
|
||||
|
||||
NameAttrList = _reflection.GeneratedProtocolMessageType(
|
||||
"NameAttrList",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
AttrEntry=_reflection.GeneratedProtocolMessageType(
|
||||
"AttrEntry",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_NAMEATTRLIST_ATTRENTRY,
|
||||
__module__="tensorboardX.src.attr_value_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.NameAttrList.AttrEntry)
|
||||
),
|
||||
),
|
||||
DESCRIPTOR=_NAMEATTRLIST,
|
||||
__module__="tensorboardX.src.attr_value_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.NameAttrList)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(NameAttrList)
|
||||
_sym_db.RegisterMessage(NameAttrList.AttrEntry)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FileOptions(), _b("\n\030org.tensorflow.frameworkB\017AttrValueProtosP\001\370\001\001")
|
||||
)
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["i"].has_options = True
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["i"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["f"].has_options = True
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["f"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["b"].has_options = True
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["b"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["type"].has_options = True
|
||||
_ATTRVALUE_LISTVALUE.fields_by_name["type"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_NAMEATTRLIST_ATTRENTRY.has_options = True
|
||||
_NAMEATTRLIST_ATTRENTRY._options = _descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b("8\001"))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,506 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/event.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from tensorboardX.src import summary_pb2 as tensorboardX_dot_src_dot_summary__pb2
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/event.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
'\n\x1ctensorboardX/src/event.proto\x12\x0btensorboard\x1a\x1etensorboardX/src/summary.proto"\xbf\x02\n\x05\x45vent\x12\x11\n\twall_time\x18\x01 \x01(\x01\x12\x0c\n\x04step\x18\x02 \x01(\x03\x12\x16\n\x0c\x66ile_version\x18\x03 \x01(\tH\x00\x12\x13\n\tgraph_def\x18\x04 \x01(\x0cH\x00\x12\'\n\x07summary\x18\x05 \x01(\x0b\x32\x14.tensorboard.SummaryH\x00\x12.\n\x0blog_message\x18\x06 \x01(\x0b\x32\x17.tensorboard.LogMessageH\x00\x12.\n\x0bsession_log\x18\x07 \x01(\x0b\x32\x17.tensorboard.SessionLogH\x00\x12=\n\x13tagged_run_metadata\x18\x08 \x01(\x0b\x32\x1e.tensorboard.TaggedRunMetadataH\x00\x12\x18\n\x0emeta_graph_def\x18\t \x01(\x0cH\x00\x42\x06\n\x04what"\x96\x01\n\nLogMessage\x12,\n\x05level\x18\x01 \x01(\x0e\x32\x1d.tensorboard.LogMessage.Level\x12\x0f\n\x07message\x18\x02 \x01(\t"I\n\x05Level\x12\x0b\n\x07UNKNOWN\x10\x00\x12\t\n\x05\x44\x45\x42UG\x10\n\x12\x08\n\x04INFO\x10\x14\x12\x08\n\x04WARN\x10\x1e\x12\t\n\x05\x45RROR\x10(\x12\t\n\x05\x46\x41TAL\x10\x32"\xb7\x01\n\nSessionLog\x12\x35\n\x06status\x18\x01 \x01(\x0e\x32%.tensorboard.SessionLog.SessionStatus\x12\x17\n\x0f\x63heckpoint_path\x18\x02 \x01(\t\x12\x0b\n\x03msg\x18\x03 \x01(\t"L\n\rSessionStatus\x12\x16\n\x12STATUS_UNSPECIFIED\x10\x00\x12\t\n\x05START\x10\x01\x12\x08\n\x04STOP\x10\x02\x12\x0e\n\nCHECKPOINT\x10\x03"6\n\x11TaggedRunMetadata\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x14\n\x0crun_metadata\x18\x02 \x01(\x0c\x42\'\n\x13org.tensorflow.utilB\x0b\x45ventProtosP\x01\xf8\x01\x01\x62\x06proto3'
|
||||
),
|
||||
dependencies=[tensorboardX_dot_src_dot_summary__pb2.DESCRIPTOR,],
|
||||
)
|
||||
|
||||
|
||||
_LOGMESSAGE_LEVEL = _descriptor.EnumDescriptor(
|
||||
name="Level",
|
||||
full_name="tensorboard.LogMessage.Level",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(name="UNKNOWN", index=0, number=0, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DEBUG", index=1, number=10, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="INFO", index=2, number=20, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="WARN", index=3, number=30, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="ERROR", index=4, number=40, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="FATAL", index=5, number=50, options=None, type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=477,
|
||||
serialized_end=550,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_LOGMESSAGE_LEVEL)
|
||||
|
||||
_SESSIONLOG_SESSIONSTATUS = _descriptor.EnumDescriptor(
|
||||
name="SessionStatus",
|
||||
full_name="tensorboard.SessionLog.SessionStatus",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(name="STATUS_UNSPECIFIED", index=0, number=0, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="START", index=1, number=1, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="STOP", index=2, number=2, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="CHECKPOINT", index=3, number=3, options=None, type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=660,
|
||||
serialized_end=736,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_SESSIONLOG_SESSIONSTATUS)
|
||||
|
||||
|
||||
_EVENT = _descriptor.Descriptor(
|
||||
name="Event",
|
||||
full_name="tensorboard.Event",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="wall_time",
|
||||
full_name="tensorboard.Event.wall_time",
|
||||
index=0,
|
||||
number=1,
|
||||
type=1,
|
||||
cpp_type=5,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=float(0),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="step",
|
||||
full_name="tensorboard.Event.step",
|
||||
index=1,
|
||||
number=2,
|
||||
type=3,
|
||||
cpp_type=2,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="file_version",
|
||||
full_name="tensorboard.Event.file_version",
|
||||
index=2,
|
||||
number=3,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="graph_def",
|
||||
full_name="tensorboard.Event.graph_def",
|
||||
index=3,
|
||||
number=4,
|
||||
type=12,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b(""),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="summary",
|
||||
full_name="tensorboard.Event.summary",
|
||||
index=4,
|
||||
number=5,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="log_message",
|
||||
full_name="tensorboard.Event.log_message",
|
||||
index=5,
|
||||
number=6,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="session_log",
|
||||
full_name="tensorboard.Event.session_log",
|
||||
index=6,
|
||||
number=7,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="tagged_run_metadata",
|
||||
full_name="tensorboard.Event.tagged_run_metadata",
|
||||
index=7,
|
||||
number=8,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="meta_graph_def",
|
||||
full_name="tensorboard.Event.meta_graph_def",
|
||||
index=8,
|
||||
number=9,
|
||||
type=12,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b(""),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
_descriptor.OneofDescriptor(
|
||||
name="what", full_name="tensorboard.Event.what", index=0, containing_type=None, fields=[]
|
||||
),
|
||||
],
|
||||
serialized_start=78,
|
||||
serialized_end=397,
|
||||
)
|
||||
|
||||
|
||||
_LOGMESSAGE = _descriptor.Descriptor(
|
||||
name="LogMessage",
|
||||
full_name="tensorboard.LogMessage",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="level",
|
||||
full_name="tensorboard.LogMessage.level",
|
||||
index=0,
|
||||
number=1,
|
||||
type=14,
|
||||
cpp_type=8,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="message",
|
||||
full_name="tensorboard.LogMessage.message",
|
||||
index=1,
|
||||
number=2,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[_LOGMESSAGE_LEVEL,],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=400,
|
||||
serialized_end=550,
|
||||
)
|
||||
|
||||
|
||||
_SESSIONLOG = _descriptor.Descriptor(
|
||||
name="SessionLog",
|
||||
full_name="tensorboard.SessionLog",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="status",
|
||||
full_name="tensorboard.SessionLog.status",
|
||||
index=0,
|
||||
number=1,
|
||||
type=14,
|
||||
cpp_type=8,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="checkpoint_path",
|
||||
full_name="tensorboard.SessionLog.checkpoint_path",
|
||||
index=1,
|
||||
number=2,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="msg",
|
||||
full_name="tensorboard.SessionLog.msg",
|
||||
index=2,
|
||||
number=3,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[_SESSIONLOG_SESSIONSTATUS,],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=553,
|
||||
serialized_end=736,
|
||||
)
|
||||
|
||||
|
||||
_TAGGEDRUNMETADATA = _descriptor.Descriptor(
|
||||
name="TaggedRunMetadata",
|
||||
full_name="tensorboard.TaggedRunMetadata",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="tag",
|
||||
full_name="tensorboard.TaggedRunMetadata.tag",
|
||||
index=0,
|
||||
number=1,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="run_metadata",
|
||||
full_name="tensorboard.TaggedRunMetadata.run_metadata",
|
||||
index=1,
|
||||
number=2,
|
||||
type=12,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b(""),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=738,
|
||||
serialized_end=792,
|
||||
)
|
||||
|
||||
_EVENT.fields_by_name["summary"].message_type = tensorboardX_dot_src_dot_summary__pb2._SUMMARY
|
||||
_EVENT.fields_by_name["log_message"].message_type = _LOGMESSAGE
|
||||
_EVENT.fields_by_name["session_log"].message_type = _SESSIONLOG
|
||||
_EVENT.fields_by_name["tagged_run_metadata"].message_type = _TAGGEDRUNMETADATA
|
||||
_EVENT.oneofs_by_name["what"].fields.append(_EVENT.fields_by_name["file_version"])
|
||||
_EVENT.fields_by_name["file_version"].containing_oneof = _EVENT.oneofs_by_name["what"]
|
||||
_EVENT.oneofs_by_name["what"].fields.append(_EVENT.fields_by_name["graph_def"])
|
||||
_EVENT.fields_by_name["graph_def"].containing_oneof = _EVENT.oneofs_by_name["what"]
|
||||
_EVENT.oneofs_by_name["what"].fields.append(_EVENT.fields_by_name["summary"])
|
||||
_EVENT.fields_by_name["summary"].containing_oneof = _EVENT.oneofs_by_name["what"]
|
||||
_EVENT.oneofs_by_name["what"].fields.append(_EVENT.fields_by_name["log_message"])
|
||||
_EVENT.fields_by_name["log_message"].containing_oneof = _EVENT.oneofs_by_name["what"]
|
||||
_EVENT.oneofs_by_name["what"].fields.append(_EVENT.fields_by_name["session_log"])
|
||||
_EVENT.fields_by_name["session_log"].containing_oneof = _EVENT.oneofs_by_name["what"]
|
||||
_EVENT.oneofs_by_name["what"].fields.append(_EVENT.fields_by_name["tagged_run_metadata"])
|
||||
_EVENT.fields_by_name["tagged_run_metadata"].containing_oneof = _EVENT.oneofs_by_name["what"]
|
||||
_EVENT.oneofs_by_name["what"].fields.append(_EVENT.fields_by_name["meta_graph_def"])
|
||||
_EVENT.fields_by_name["meta_graph_def"].containing_oneof = _EVENT.oneofs_by_name["what"]
|
||||
_LOGMESSAGE.fields_by_name["level"].enum_type = _LOGMESSAGE_LEVEL
|
||||
_LOGMESSAGE_LEVEL.containing_type = _LOGMESSAGE
|
||||
_SESSIONLOG.fields_by_name["status"].enum_type = _SESSIONLOG_SESSIONSTATUS
|
||||
_SESSIONLOG_SESSIONSTATUS.containing_type = _SESSIONLOG
|
||||
DESCRIPTOR.message_types_by_name["Event"] = _EVENT
|
||||
DESCRIPTOR.message_types_by_name["LogMessage"] = _LOGMESSAGE
|
||||
DESCRIPTOR.message_types_by_name["SessionLog"] = _SESSIONLOG
|
||||
DESCRIPTOR.message_types_by_name["TaggedRunMetadata"] = _TAGGEDRUNMETADATA
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
Event = _reflection.GeneratedProtocolMessageType(
|
||||
"Event",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_EVENT,
|
||||
__module__="tensorboardX.src.event_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.Event)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(Event)
|
||||
|
||||
LogMessage = _reflection.GeneratedProtocolMessageType(
|
||||
"LogMessage",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_LOGMESSAGE,
|
||||
__module__="tensorboardX.src.event_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.LogMessage)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(LogMessage)
|
||||
|
||||
SessionLog = _reflection.GeneratedProtocolMessageType(
|
||||
"SessionLog",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_SESSIONLOG,
|
||||
__module__="tensorboardX.src.event_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.SessionLog)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(SessionLog)
|
||||
|
||||
TaggedRunMetadata = _reflection.GeneratedProtocolMessageType(
|
||||
"TaggedRunMetadata",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_TAGGEDRUNMETADATA,
|
||||
__module__="tensorboardX.src.event_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.TaggedRunMetadata)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(TaggedRunMetadata)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FileOptions(), _b("\n\023org.tensorflow.utilB\013EventProtosP\001\370\001\001")
|
||||
)
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,129 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/graph.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from tensorboardX.src import node_def_pb2 as tensorboardX_dot_src_dot_node__def__pb2
|
||||
from tensorboardX.src import versions_pb2 as tensorboardX_dot_src_dot_versions__pb2
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/graph.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
'\n\x1ctensorboardX/src/graph.proto\x12\x0btensorboard\x1a\x1ftensorboardX/src/node_def.proto\x1a\x1ftensorboardX/src/versions.proto"n\n\x08GraphDef\x12"\n\x04node\x18\x01 \x03(\x0b\x32\x14.tensorboard.NodeDef\x12)\n\x08versions\x18\x04 \x01(\x0b\x32\x17.tensorboard.VersionDef\x12\x13\n\x07version\x18\x03 \x01(\x05\x42\x02\x18\x01\x42,\n\x18org.tensorflow.frameworkB\x0bGraphProtosP\x01\xf8\x01\x01\x62\x06proto3'
|
||||
),
|
||||
dependencies=[
|
||||
tensorboardX_dot_src_dot_node__def__pb2.DESCRIPTOR,
|
||||
tensorboardX_dot_src_dot_versions__pb2.DESCRIPTOR,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
_GRAPHDEF = _descriptor.Descriptor(
|
||||
name="GraphDef",
|
||||
full_name="tensorboard.GraphDef",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="node",
|
||||
full_name="tensorboard.GraphDef.node",
|
||||
index=0,
|
||||
number=1,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="versions",
|
||||
full_name="tensorboard.GraphDef.versions",
|
||||
index=1,
|
||||
number=4,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="version",
|
||||
full_name="tensorboard.GraphDef.version",
|
||||
index=2,
|
||||
number=3,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\030\001")),
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=111,
|
||||
serialized_end=221,
|
||||
)
|
||||
|
||||
_GRAPHDEF.fields_by_name["node"].message_type = tensorboardX_dot_src_dot_node__def__pb2._NODEDEF
|
||||
_GRAPHDEF.fields_by_name["versions"].message_type = tensorboardX_dot_src_dot_versions__pb2._VERSIONDEF
|
||||
DESCRIPTOR.message_types_by_name["GraphDef"] = _GRAPHDEF
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
GraphDef = _reflection.GeneratedProtocolMessageType(
|
||||
"GraphDef",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_GRAPHDEF,
|
||||
__module__="tensorboardX.src.graph_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.GraphDef)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(GraphDef)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FileOptions(), _b("\n\030org.tensorflow.frameworkB\013GraphProtosP\001\370\001\001")
|
||||
)
|
||||
_GRAPHDEF.fields_by_name["version"].has_options = True
|
||||
_GRAPHDEF.fields_by_name["version"]._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\030\001"))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,224 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/node_def.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from tensorboardX.src import attr_value_pb2 as tensorboardX_dot_src_dot_attr__value__pb2
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/node_def.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
'\n\x1ftensorboardX/src/node_def.proto\x12\x0btensorboard\x1a!tensorboardX/src/attr_value.proto"\xb5\x01\n\x07NodeDef\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\n\n\x02op\x18\x02 \x01(\t\x12\r\n\x05input\x18\x03 \x03(\t\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12,\n\x04\x61ttr\x18\x05 \x03(\x0b\x32\x1e.tensorboard.NodeDef.AttrEntry\x1a\x43\n\tAttrEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.tensorboard.AttrValue:\x02\x38\x01\x42*\n\x18org.tensorflow.frameworkB\tNodeProtoP\x01\xf8\x01\x01\x62\x06proto3'
|
||||
),
|
||||
dependencies=[tensorboardX_dot_src_dot_attr__value__pb2.DESCRIPTOR,],
|
||||
)
|
||||
|
||||
|
||||
_NODEDEF_ATTRENTRY = _descriptor.Descriptor(
|
||||
name="AttrEntry",
|
||||
full_name="tensorboard.NodeDef.AttrEntry",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="key",
|
||||
full_name="tensorboard.NodeDef.AttrEntry.key",
|
||||
index=0,
|
||||
number=1,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="value",
|
||||
full_name="tensorboard.NodeDef.AttrEntry.value",
|
||||
index=1,
|
||||
number=2,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b("8\001")),
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=198,
|
||||
serialized_end=265,
|
||||
)
|
||||
|
||||
_NODEDEF = _descriptor.Descriptor(
|
||||
name="NodeDef",
|
||||
full_name="tensorboard.NodeDef",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="name",
|
||||
full_name="tensorboard.NodeDef.name",
|
||||
index=0,
|
||||
number=1,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="op",
|
||||
full_name="tensorboard.NodeDef.op",
|
||||
index=1,
|
||||
number=2,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="input",
|
||||
full_name="tensorboard.NodeDef.input",
|
||||
index=2,
|
||||
number=3,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="device",
|
||||
full_name="tensorboard.NodeDef.device",
|
||||
index=3,
|
||||
number=4,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="attr",
|
||||
full_name="tensorboard.NodeDef.attr",
|
||||
index=4,
|
||||
number=5,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[_NODEDEF_ATTRENTRY,],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=84,
|
||||
serialized_end=265,
|
||||
)
|
||||
|
||||
_NODEDEF_ATTRENTRY.fields_by_name["value"].message_type = tensorboardX_dot_src_dot_attr__value__pb2._ATTRVALUE
|
||||
_NODEDEF_ATTRENTRY.containing_type = _NODEDEF
|
||||
_NODEDEF.fields_by_name["attr"].message_type = _NODEDEF_ATTRENTRY
|
||||
DESCRIPTOR.message_types_by_name["NodeDef"] = _NODEDEF
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
NodeDef = _reflection.GeneratedProtocolMessageType(
|
||||
"NodeDef",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
AttrEntry=_reflection.GeneratedProtocolMessageType(
|
||||
"AttrEntry",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_NODEDEF_ATTRENTRY,
|
||||
__module__="tensorboardX.src.node_def_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.NodeDef.AttrEntry)
|
||||
),
|
||||
),
|
||||
DESCRIPTOR=_NODEDEF,
|
||||
__module__="tensorboardX.src.node_def_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.NodeDef)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(NodeDef)
|
||||
_sym_db.RegisterMessage(NodeDef.AttrEntry)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FileOptions(), _b("\n\030org.tensorflow.frameworkB\tNodeProtoP\001\370\001\001")
|
||||
)
|
||||
_NODEDEF_ATTRENTRY.has_options = True
|
||||
_NODEDEF_ATTRENTRY._options = _descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b("8\001"))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,97 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/plugin_pr_curve.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/plugin_pr_curve.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
'\n&tensorboardX/src/plugin_pr_curve.proto\x12\x0btensorboard"<\n\x11PrCurvePluginData\x12\x0f\n\x07version\x18\x01 \x01(\x05\x12\x16\n\x0enum_thresholds\x18\x02 \x01(\rb\x06proto3'
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
_PRCURVEPLUGINDATA = _descriptor.Descriptor(
|
||||
name="PrCurvePluginData",
|
||||
full_name="tensorboard.PrCurvePluginData",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="version",
|
||||
full_name="tensorboard.PrCurvePluginData.version",
|
||||
index=0,
|
||||
number=1,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="num_thresholds",
|
||||
full_name="tensorboard.PrCurvePluginData.num_thresholds",
|
||||
index=1,
|
||||
number=2,
|
||||
type=13,
|
||||
cpp_type=3,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=55,
|
||||
serialized_end=115,
|
||||
)
|
||||
|
||||
DESCRIPTOR.message_types_by_name["PrCurvePluginData"] = _PRCURVEPLUGINDATA
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
PrCurvePluginData = _reflection.GeneratedProtocolMessageType(
|
||||
"PrCurvePluginData",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_PRCURVEPLUGINDATA,
|
||||
__module__="tensorboardX.src.plugin_pr_curve_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.PrCurvePluginData)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(PrCurvePluginData)
|
||||
|
||||
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,152 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/resource_handle.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/resource_handle.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
'\n&tensorboardX/src/resource_handle.proto\x12\x0btensorboard"r\n\x13ResourceHandleProto\x12\x0e\n\x06\x64\x65vice\x18\x01 \x01(\t\x12\x11\n\tcontainer\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\thash_code\x18\x04 \x01(\x04\x12\x17\n\x0fmaybe_type_name\x18\x05 \x01(\tB/\n\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01\xf8\x01\x01\x62\x06proto3'
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
_RESOURCEHANDLEPROTO = _descriptor.Descriptor(
|
||||
name="ResourceHandleProto",
|
||||
full_name="tensorboard.ResourceHandleProto",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="device",
|
||||
full_name="tensorboard.ResourceHandleProto.device",
|
||||
index=0,
|
||||
number=1,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="container",
|
||||
full_name="tensorboard.ResourceHandleProto.container",
|
||||
index=1,
|
||||
number=2,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="name",
|
||||
full_name="tensorboard.ResourceHandleProto.name",
|
||||
index=2,
|
||||
number=3,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="hash_code",
|
||||
full_name="tensorboard.ResourceHandleProto.hash_code",
|
||||
index=3,
|
||||
number=4,
|
||||
type=4,
|
||||
cpp_type=4,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="maybe_type_name",
|
||||
full_name="tensorboard.ResourceHandleProto.maybe_type_name",
|
||||
index=4,
|
||||
number=5,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=55,
|
||||
serialized_end=169,
|
||||
)
|
||||
|
||||
DESCRIPTOR.message_types_by_name["ResourceHandleProto"] = _RESOURCEHANDLEPROTO
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
ResourceHandleProto = _reflection.GeneratedProtocolMessageType(
|
||||
"ResourceHandleProto",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_RESOURCEHANDLEPROTO,
|
||||
__module__="tensorboardX.src.resource_handle_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.ResourceHandleProto)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(ResourceHandleProto)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FileOptions(), _b("\n\030org.tensorflow.frameworkB\016ResourceHandleP\001\370\001\001")
|
||||
)
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,834 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/summary.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from tensorboardX.src import tensor_pb2 as tensorboardX_dot_src_dot_tensor__pb2
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/summary.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
'\n\x1etensorboardX/src/summary.proto\x12\x0btensorboard\x1a\x1dtensorboardX/src/tensor.proto"\'\n\x12SummaryDescription\x12\x11\n\ttype_hint\x18\x01 \x01(\t"\x87\x01\n\x0eHistogramProto\x12\x0b\n\x03min\x18\x01 \x01(\x01\x12\x0b\n\x03max\x18\x02 \x01(\x01\x12\x0b\n\x03num\x18\x03 \x01(\x01\x12\x0b\n\x03sum\x18\x04 \x01(\x01\x12\x13\n\x0bsum_squares\x18\x05 \x01(\x01\x12\x18\n\x0c\x62ucket_limit\x18\x06 \x03(\x01\x42\x02\x10\x01\x12\x12\n\x06\x62ucket\x18\x07 \x03(\x01\x42\x02\x10\x01"\x83\x01\n\x0fSummaryMetadata\x12<\n\x0bplugin_data\x18\x01 \x03(\x0b\x32\'.tensorboard.SummaryMetadata.PluginData\x1a\x32\n\nPluginData\x12\x13\n\x0bplugin_name\x18\x01 \x01(\t\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\t"\xe4\x04\n\x07Summary\x12)\n\x05value\x18\x01 \x03(\x0b\x32\x1a.tensorboard.Summary.Value\x1aX\n\x05Image\x12\x0e\n\x06height\x18\x01 \x01(\x05\x12\r\n\x05width\x18\x02 \x01(\x05\x12\x12\n\ncolorspace\x18\x03 \x01(\x05\x12\x1c\n\x14\x65ncoded_image_string\x18\x04 \x01(\x0c\x1a}\n\x05\x41udio\x12\x13\n\x0bsample_rate\x18\x01 \x01(\x02\x12\x14\n\x0cnum_channels\x18\x02 \x01(\x03\x12\x15\n\rlength_frames\x18\x03 \x01(\x03\x12\x1c\n\x14\x65ncoded_audio_string\x18\x04 \x01(\x0c\x12\x14\n\x0c\x63ontent_type\x18\x05 \x01(\t\x1a\xd4\x02\n\x05Value\x12\x11\n\tnode_name\x18\x07 \x01(\t\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12.\n\x08metadata\x18\t \x01(\x0b\x32\x1c.tensorboard.SummaryMetadata\x12\x16\n\x0csimple_value\x18\x02 \x01(\x02H\x00\x12&\n\x1cobsolete_old_style_histogram\x18\x03 \x01(\x0cH\x00\x12+\n\x05image\x18\x04 \x01(\x0b\x32\x1a.tensorboard.Summary.ImageH\x00\x12,\n\x05histo\x18\x05 \x01(\x0b\x32\x1b.tensorboard.HistogramProtoH\x00\x12+\n\x05\x61udio\x18\x06 \x01(\x0b\x32\x1a.tensorboard.Summary.AudioH\x00\x12*\n\x06tensor\x18\x08 \x01(\x0b\x32\x18.tensorboard.TensorProtoH\x00\x42\x07\n\x05valueB.\n\x18org.tensorflow.frameworkB\rSummaryProtosP\x01\xf8\x01\x01\x62\x06proto3'
|
||||
),
|
||||
dependencies=[tensorboardX_dot_src_dot_tensor__pb2.DESCRIPTOR,],
|
||||
)
|
||||
|
||||
|
||||
_SUMMARYDESCRIPTION = _descriptor.Descriptor(
|
||||
name="SummaryDescription",
|
||||
full_name="tensorboard.SummaryDescription",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="type_hint",
|
||||
full_name="tensorboard.SummaryDescription.type_hint",
|
||||
index=0,
|
||||
number=1,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=78,
|
||||
serialized_end=117,
|
||||
)
|
||||
|
||||
|
||||
_HISTOGRAMPROTO = _descriptor.Descriptor(
|
||||
name="HistogramProto",
|
||||
full_name="tensorboard.HistogramProto",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="min",
|
||||
full_name="tensorboard.HistogramProto.min",
|
||||
index=0,
|
||||
number=1,
|
||||
type=1,
|
||||
cpp_type=5,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=float(0),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="max",
|
||||
full_name="tensorboard.HistogramProto.max",
|
||||
index=1,
|
||||
number=2,
|
||||
type=1,
|
||||
cpp_type=5,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=float(0),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="num",
|
||||
full_name="tensorboard.HistogramProto.num",
|
||||
index=2,
|
||||
number=3,
|
||||
type=1,
|
||||
cpp_type=5,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=float(0),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="sum",
|
||||
full_name="tensorboard.HistogramProto.sum",
|
||||
index=3,
|
||||
number=4,
|
||||
type=1,
|
||||
cpp_type=5,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=float(0),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="sum_squares",
|
||||
full_name="tensorboard.HistogramProto.sum_squares",
|
||||
index=4,
|
||||
number=5,
|
||||
type=1,
|
||||
cpp_type=5,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=float(0),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="bucket_limit",
|
||||
full_name="tensorboard.HistogramProto.bucket_limit",
|
||||
index=5,
|
||||
number=6,
|
||||
type=1,
|
||||
cpp_type=5,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="bucket",
|
||||
full_name="tensorboard.HistogramProto.bucket",
|
||||
index=6,
|
||||
number=7,
|
||||
type=1,
|
||||
cpp_type=5,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=120,
|
||||
serialized_end=255,
|
||||
)
|
||||
|
||||
|
||||
_SUMMARYMETADATA_PLUGINDATA = _descriptor.Descriptor(
|
||||
name="PluginData",
|
||||
full_name="tensorboard.SummaryMetadata.PluginData",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="plugin_name",
|
||||
full_name="tensorboard.SummaryMetadata.PluginData.plugin_name",
|
||||
index=0,
|
||||
number=1,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="content",
|
||||
full_name="tensorboard.SummaryMetadata.PluginData.content",
|
||||
index=1,
|
||||
number=2,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=339,
|
||||
serialized_end=389,
|
||||
)
|
||||
|
||||
_SUMMARYMETADATA = _descriptor.Descriptor(
|
||||
name="SummaryMetadata",
|
||||
full_name="tensorboard.SummaryMetadata",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="plugin_data",
|
||||
full_name="tensorboard.SummaryMetadata.plugin_data",
|
||||
index=0,
|
||||
number=1,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[_SUMMARYMETADATA_PLUGINDATA,],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=258,
|
||||
serialized_end=389,
|
||||
)
|
||||
|
||||
|
||||
_SUMMARY_IMAGE = _descriptor.Descriptor(
|
||||
name="Image",
|
||||
full_name="tensorboard.Summary.Image",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="height",
|
||||
full_name="tensorboard.Summary.Image.height",
|
||||
index=0,
|
||||
number=1,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="width",
|
||||
full_name="tensorboard.Summary.Image.width",
|
||||
index=1,
|
||||
number=2,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="colorspace",
|
||||
full_name="tensorboard.Summary.Image.colorspace",
|
||||
index=2,
|
||||
number=3,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="encoded_image_string",
|
||||
full_name="tensorboard.Summary.Image.encoded_image_string",
|
||||
index=3,
|
||||
number=4,
|
||||
type=12,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b(""),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=446,
|
||||
serialized_end=534,
|
||||
)
|
||||
|
||||
_SUMMARY_AUDIO = _descriptor.Descriptor(
|
||||
name="Audio",
|
||||
full_name="tensorboard.Summary.Audio",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="sample_rate",
|
||||
full_name="tensorboard.Summary.Audio.sample_rate",
|
||||
index=0,
|
||||
number=1,
|
||||
type=2,
|
||||
cpp_type=6,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=float(0),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="num_channels",
|
||||
full_name="tensorboard.Summary.Audio.num_channels",
|
||||
index=1,
|
||||
number=2,
|
||||
type=3,
|
||||
cpp_type=2,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="length_frames",
|
||||
full_name="tensorboard.Summary.Audio.length_frames",
|
||||
index=2,
|
||||
number=3,
|
||||
type=3,
|
||||
cpp_type=2,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="encoded_audio_string",
|
||||
full_name="tensorboard.Summary.Audio.encoded_audio_string",
|
||||
index=3,
|
||||
number=4,
|
||||
type=12,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b(""),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="content_type",
|
||||
full_name="tensorboard.Summary.Audio.content_type",
|
||||
index=4,
|
||||
number=5,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=536,
|
||||
serialized_end=661,
|
||||
)
|
||||
|
||||
_SUMMARY_VALUE = _descriptor.Descriptor(
|
||||
name="Value",
|
||||
full_name="tensorboard.Summary.Value",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="node_name",
|
||||
full_name="tensorboard.Summary.Value.node_name",
|
||||
index=0,
|
||||
number=7,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="tag",
|
||||
full_name="tensorboard.Summary.Value.tag",
|
||||
index=1,
|
||||
number=1,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="metadata",
|
||||
full_name="tensorboard.Summary.Value.metadata",
|
||||
index=2,
|
||||
number=9,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="simple_value",
|
||||
full_name="tensorboard.Summary.Value.simple_value",
|
||||
index=3,
|
||||
number=2,
|
||||
type=2,
|
||||
cpp_type=6,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=float(0),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="obsolete_old_style_histogram",
|
||||
full_name="tensorboard.Summary.Value.obsolete_old_style_histogram",
|
||||
index=4,
|
||||
number=3,
|
||||
type=12,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b(""),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="image",
|
||||
full_name="tensorboard.Summary.Value.image",
|
||||
index=5,
|
||||
number=4,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="histo",
|
||||
full_name="tensorboard.Summary.Value.histo",
|
||||
index=6,
|
||||
number=5,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="audio",
|
||||
full_name="tensorboard.Summary.Value.audio",
|
||||
index=7,
|
||||
number=6,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="tensor",
|
||||
full_name="tensorboard.Summary.Value.tensor",
|
||||
index=8,
|
||||
number=8,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
_descriptor.OneofDescriptor(
|
||||
name="value", full_name="tensorboard.Summary.Value.value", index=0, containing_type=None, fields=[]
|
||||
),
|
||||
],
|
||||
serialized_start=664,
|
||||
serialized_end=1004,
|
||||
)
|
||||
|
||||
_SUMMARY = _descriptor.Descriptor(
|
||||
name="Summary",
|
||||
full_name="tensorboard.Summary",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="value",
|
||||
full_name="tensorboard.Summary.value",
|
||||
index=0,
|
||||
number=1,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[_SUMMARY_IMAGE, _SUMMARY_AUDIO, _SUMMARY_VALUE,],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=392,
|
||||
serialized_end=1004,
|
||||
)
|
||||
|
||||
_SUMMARYMETADATA_PLUGINDATA.containing_type = _SUMMARYMETADATA
|
||||
_SUMMARYMETADATA.fields_by_name["plugin_data"].message_type = _SUMMARYMETADATA_PLUGINDATA
|
||||
_SUMMARY_IMAGE.containing_type = _SUMMARY
|
||||
_SUMMARY_AUDIO.containing_type = _SUMMARY
|
||||
_SUMMARY_VALUE.fields_by_name["metadata"].message_type = _SUMMARYMETADATA
|
||||
_SUMMARY_VALUE.fields_by_name["image"].message_type = _SUMMARY_IMAGE
|
||||
_SUMMARY_VALUE.fields_by_name["histo"].message_type = _HISTOGRAMPROTO
|
||||
_SUMMARY_VALUE.fields_by_name["audio"].message_type = _SUMMARY_AUDIO
|
||||
_SUMMARY_VALUE.fields_by_name["tensor"].message_type = tensorboardX_dot_src_dot_tensor__pb2._TENSORPROTO
|
||||
_SUMMARY_VALUE.containing_type = _SUMMARY
|
||||
_SUMMARY_VALUE.oneofs_by_name["value"].fields.append(_SUMMARY_VALUE.fields_by_name["simple_value"])
|
||||
_SUMMARY_VALUE.fields_by_name["simple_value"].containing_oneof = _SUMMARY_VALUE.oneofs_by_name["value"]
|
||||
_SUMMARY_VALUE.oneofs_by_name["value"].fields.append(_SUMMARY_VALUE.fields_by_name["obsolete_old_style_histogram"])
|
||||
_SUMMARY_VALUE.fields_by_name["obsolete_old_style_histogram"].containing_oneof = _SUMMARY_VALUE.oneofs_by_name["value"]
|
||||
_SUMMARY_VALUE.oneofs_by_name["value"].fields.append(_SUMMARY_VALUE.fields_by_name["image"])
|
||||
_SUMMARY_VALUE.fields_by_name["image"].containing_oneof = _SUMMARY_VALUE.oneofs_by_name["value"]
|
||||
_SUMMARY_VALUE.oneofs_by_name["value"].fields.append(_SUMMARY_VALUE.fields_by_name["histo"])
|
||||
_SUMMARY_VALUE.fields_by_name["histo"].containing_oneof = _SUMMARY_VALUE.oneofs_by_name["value"]
|
||||
_SUMMARY_VALUE.oneofs_by_name["value"].fields.append(_SUMMARY_VALUE.fields_by_name["audio"])
|
||||
_SUMMARY_VALUE.fields_by_name["audio"].containing_oneof = _SUMMARY_VALUE.oneofs_by_name["value"]
|
||||
_SUMMARY_VALUE.oneofs_by_name["value"].fields.append(_SUMMARY_VALUE.fields_by_name["tensor"])
|
||||
_SUMMARY_VALUE.fields_by_name["tensor"].containing_oneof = _SUMMARY_VALUE.oneofs_by_name["value"]
|
||||
_SUMMARY.fields_by_name["value"].message_type = _SUMMARY_VALUE
|
||||
DESCRIPTOR.message_types_by_name["SummaryDescription"] = _SUMMARYDESCRIPTION
|
||||
DESCRIPTOR.message_types_by_name["HistogramProto"] = _HISTOGRAMPROTO
|
||||
DESCRIPTOR.message_types_by_name["SummaryMetadata"] = _SUMMARYMETADATA
|
||||
DESCRIPTOR.message_types_by_name["Summary"] = _SUMMARY
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
SummaryDescription = _reflection.GeneratedProtocolMessageType(
|
||||
"SummaryDescription",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_SUMMARYDESCRIPTION,
|
||||
__module__="tensorboardX.src.summary_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.SummaryDescription)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(SummaryDescription)
|
||||
|
||||
HistogramProto = _reflection.GeneratedProtocolMessageType(
|
||||
"HistogramProto",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_HISTOGRAMPROTO,
|
||||
__module__="tensorboardX.src.summary_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.HistogramProto)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(HistogramProto)
|
||||
|
||||
SummaryMetadata = _reflection.GeneratedProtocolMessageType(
|
||||
"SummaryMetadata",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
PluginData=_reflection.GeneratedProtocolMessageType(
|
||||
"PluginData",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_SUMMARYMETADATA_PLUGINDATA,
|
||||
__module__="tensorboardX.src.summary_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.SummaryMetadata.PluginData)
|
||||
),
|
||||
),
|
||||
DESCRIPTOR=_SUMMARYMETADATA,
|
||||
__module__="tensorboardX.src.summary_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.SummaryMetadata)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(SummaryMetadata)
|
||||
_sym_db.RegisterMessage(SummaryMetadata.PluginData)
|
||||
|
||||
Summary = _reflection.GeneratedProtocolMessageType(
|
||||
"Summary",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
Image=_reflection.GeneratedProtocolMessageType(
|
||||
"Image",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_SUMMARY_IMAGE,
|
||||
__module__="tensorboardX.src.summary_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.Summary.Image)
|
||||
),
|
||||
),
|
||||
Audio=_reflection.GeneratedProtocolMessageType(
|
||||
"Audio",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_SUMMARY_AUDIO,
|
||||
__module__="tensorboardX.src.summary_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.Summary.Audio)
|
||||
),
|
||||
),
|
||||
Value=_reflection.GeneratedProtocolMessageType(
|
||||
"Value",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_SUMMARY_VALUE,
|
||||
__module__="tensorboardX.src.summary_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.Summary.Value)
|
||||
),
|
||||
),
|
||||
DESCRIPTOR=_SUMMARY,
|
||||
__module__="tensorboardX.src.summary_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.Summary)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(Summary)
|
||||
_sym_db.RegisterMessage(Summary.Image)
|
||||
_sym_db.RegisterMessage(Summary.Audio)
|
||||
_sym_db.RegisterMessage(Summary.Value)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FileOptions(), _b("\n\030org.tensorflow.frameworkB\rSummaryProtosP\001\370\001\001")
|
||||
)
|
||||
_HISTOGRAMPROTO.fields_by_name["bucket_limit"].has_options = True
|
||||
_HISTOGRAMPROTO.fields_by_name["bucket_limit"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_HISTOGRAMPROTO.fields_by_name["bucket"].has_options = True
|
||||
_HISTOGRAMPROTO.fields_by_name["bucket"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,351 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/tensor.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from tensorboardX.src import resource_handle_pb2 as tensorboardX_dot_src_dot_resource__handle__pb2
|
||||
from tensorboardX.src import tensor_shape_pb2 as tensorboardX_dot_src_dot_tensor__shape__pb2
|
||||
from tensorboardX.src import types_pb2 as tensorboardX_dot_src_dot_types__pb2
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/tensor.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
'\n\x1dtensorboardX/src/tensor.proto\x12\x0btensorboard\x1a&tensorboardX/src/resource_handle.proto\x1a#tensorboardX/src/tensor_shape.proto\x1a\x1ctensorboardX/src/types.proto"\xa6\x03\n\x0bTensorProto\x12$\n\x05\x64type\x18\x01 \x01(\x0e\x32\x15.tensorboard.DataType\x12\x33\n\x0ctensor_shape\x18\x02 \x01(\x0b\x32\x1d.tensorboard.TensorShapeProto\x12\x16\n\x0eversion_number\x18\x03 \x01(\x05\x12\x16\n\x0etensor_content\x18\x04 \x01(\x0c\x12\x14\n\x08half_val\x18\r \x03(\x05\x42\x02\x10\x01\x12\x15\n\tfloat_val\x18\x05 \x03(\x02\x42\x02\x10\x01\x12\x16\n\ndouble_val\x18\x06 \x03(\x01\x42\x02\x10\x01\x12\x13\n\x07int_val\x18\x07 \x03(\x05\x42\x02\x10\x01\x12\x12\n\nstring_val\x18\x08 \x03(\x0c\x12\x18\n\x0cscomplex_val\x18\t \x03(\x02\x42\x02\x10\x01\x12\x15\n\tint64_val\x18\n \x03(\x03\x42\x02\x10\x01\x12\x14\n\x08\x62ool_val\x18\x0b \x03(\x08\x42\x02\x10\x01\x12\x18\n\x0c\x64\x63omplex_val\x18\x0c \x03(\x01\x42\x02\x10\x01\x12=\n\x13resource_handle_val\x18\x0e \x03(\x0b\x32 .tensorboard.ResourceHandleProtoB-\n\x18org.tensorflow.frameworkB\x0cTensorProtosP\x01\xf8\x01\x01\x62\x06proto3'
|
||||
),
|
||||
dependencies=[
|
||||
tensorboardX_dot_src_dot_resource__handle__pb2.DESCRIPTOR,
|
||||
tensorboardX_dot_src_dot_tensor__shape__pb2.DESCRIPTOR,
|
||||
tensorboardX_dot_src_dot_types__pb2.DESCRIPTOR,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
_TENSORPROTO = _descriptor.Descriptor(
|
||||
name="TensorProto",
|
||||
full_name="tensorboard.TensorProto",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="dtype",
|
||||
full_name="tensorboard.TensorProto.dtype",
|
||||
index=0,
|
||||
number=1,
|
||||
type=14,
|
||||
cpp_type=8,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="tensor_shape",
|
||||
full_name="tensorboard.TensorProto.tensor_shape",
|
||||
index=1,
|
||||
number=2,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=None,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="version_number",
|
||||
full_name="tensorboard.TensorProto.version_number",
|
||||
index=2,
|
||||
number=3,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="tensor_content",
|
||||
full_name="tensorboard.TensorProto.tensor_content",
|
||||
index=3,
|
||||
number=4,
|
||||
type=12,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b(""),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="half_val",
|
||||
full_name="tensorboard.TensorProto.half_val",
|
||||
index=4,
|
||||
number=13,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="float_val",
|
||||
full_name="tensorboard.TensorProto.float_val",
|
||||
index=5,
|
||||
number=5,
|
||||
type=2,
|
||||
cpp_type=6,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="double_val",
|
||||
full_name="tensorboard.TensorProto.double_val",
|
||||
index=6,
|
||||
number=6,
|
||||
type=1,
|
||||
cpp_type=5,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="int_val",
|
||||
full_name="tensorboard.TensorProto.int_val",
|
||||
index=7,
|
||||
number=7,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="string_val",
|
||||
full_name="tensorboard.TensorProto.string_val",
|
||||
index=8,
|
||||
number=8,
|
||||
type=12,
|
||||
cpp_type=9,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="scomplex_val",
|
||||
full_name="tensorboard.TensorProto.scomplex_val",
|
||||
index=9,
|
||||
number=9,
|
||||
type=2,
|
||||
cpp_type=6,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="int64_val",
|
||||
full_name="tensorboard.TensorProto.int64_val",
|
||||
index=10,
|
||||
number=10,
|
||||
type=3,
|
||||
cpp_type=2,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="bool_val",
|
||||
full_name="tensorboard.TensorProto.bool_val",
|
||||
index=11,
|
||||
number=11,
|
||||
type=8,
|
||||
cpp_type=7,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="dcomplex_val",
|
||||
full_name="tensorboard.TensorProto.dcomplex_val",
|
||||
index=12,
|
||||
number=12,
|
||||
type=1,
|
||||
cpp_type=5,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b("\020\001")),
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="resource_handle_val",
|
||||
full_name="tensorboard.TensorProto.resource_handle_val",
|
||||
index=13,
|
||||
number=14,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=154,
|
||||
serialized_end=576,
|
||||
)
|
||||
|
||||
_TENSORPROTO.fields_by_name["dtype"].enum_type = tensorboardX_dot_src_dot_types__pb2._DATATYPE
|
||||
_TENSORPROTO.fields_by_name["tensor_shape"].message_type = tensorboardX_dot_src_dot_tensor__shape__pb2._TENSORSHAPEPROTO
|
||||
_TENSORPROTO.fields_by_name[
|
||||
"resource_handle_val"
|
||||
].message_type = tensorboardX_dot_src_dot_resource__handle__pb2._RESOURCEHANDLEPROTO
|
||||
DESCRIPTOR.message_types_by_name["TensorProto"] = _TENSORPROTO
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
TensorProto = _reflection.GeneratedProtocolMessageType(
|
||||
"TensorProto",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_TENSORPROTO,
|
||||
__module__="tensorboardX.src.tensor_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.TensorProto)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(TensorProto)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FileOptions(), _b("\n\030org.tensorflow.frameworkB\014TensorProtosP\001\370\001\001")
|
||||
)
|
||||
_TENSORPROTO.fields_by_name["half_val"].has_options = True
|
||||
_TENSORPROTO.fields_by_name["half_val"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_TENSORPROTO.fields_by_name["float_val"].has_options = True
|
||||
_TENSORPROTO.fields_by_name["float_val"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_TENSORPROTO.fields_by_name["double_val"].has_options = True
|
||||
_TENSORPROTO.fields_by_name["double_val"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_TENSORPROTO.fields_by_name["int_val"].has_options = True
|
||||
_TENSORPROTO.fields_by_name["int_val"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_TENSORPROTO.fields_by_name["scomplex_val"].has_options = True
|
||||
_TENSORPROTO.fields_by_name["scomplex_val"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_TENSORPROTO.fields_by_name["int64_val"].has_options = True
|
||||
_TENSORPROTO.fields_by_name["int64_val"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_TENSORPROTO.fields_by_name["bool_val"].has_options = True
|
||||
_TENSORPROTO.fields_by_name["bool_val"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
_TENSORPROTO.fields_by_name["dcomplex_val"].has_options = True
|
||||
_TENSORPROTO.fields_by_name["dcomplex_val"]._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FieldOptions(), _b("\020\001")
|
||||
)
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,167 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/tensor_shape.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/tensor_shape.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
'\n#tensorboardX/src/tensor_shape.proto\x12\x0btensorboard"{\n\x10TensorShapeProto\x12.\n\x03\x64im\x18\x02 \x03(\x0b\x32!.tensorboard.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB2\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01\xf8\x01\x01\x62\x06proto3'
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
_TENSORSHAPEPROTO_DIM = _descriptor.Descriptor(
|
||||
name="Dim",
|
||||
full_name="tensorboard.TensorShapeProto.Dim",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="size",
|
||||
full_name="tensorboard.TensorShapeProto.Dim.size",
|
||||
index=0,
|
||||
number=1,
|
||||
type=3,
|
||||
cpp_type=2,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="name",
|
||||
full_name="tensorboard.TensorShapeProto.Dim.name",
|
||||
index=1,
|
||||
number=2,
|
||||
type=9,
|
||||
cpp_type=9,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=_b("").decode("utf-8"),
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=142,
|
||||
serialized_end=175,
|
||||
)
|
||||
|
||||
_TENSORSHAPEPROTO = _descriptor.Descriptor(
|
||||
name="TensorShapeProto",
|
||||
full_name="tensorboard.TensorShapeProto",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="dim",
|
||||
full_name="tensorboard.TensorShapeProto.dim",
|
||||
index=0,
|
||||
number=2,
|
||||
type=11,
|
||||
cpp_type=10,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="unknown_rank",
|
||||
full_name="tensorboard.TensorShapeProto.unknown_rank",
|
||||
index=1,
|
||||
number=3,
|
||||
type=8,
|
||||
cpp_type=7,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=False,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[_TENSORSHAPEPROTO_DIM,],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=52,
|
||||
serialized_end=175,
|
||||
)
|
||||
|
||||
_TENSORSHAPEPROTO_DIM.containing_type = _TENSORSHAPEPROTO
|
||||
_TENSORSHAPEPROTO.fields_by_name["dim"].message_type = _TENSORSHAPEPROTO_DIM
|
||||
DESCRIPTOR.message_types_by_name["TensorShapeProto"] = _TENSORSHAPEPROTO
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
TensorShapeProto = _reflection.GeneratedProtocolMessageType(
|
||||
"TensorShapeProto",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
Dim=_reflection.GeneratedProtocolMessageType(
|
||||
"Dim",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_TENSORSHAPEPROTO_DIM,
|
||||
__module__="tensorboardX.src.tensor_shape_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.TensorShapeProto.Dim)
|
||||
),
|
||||
),
|
||||
DESCRIPTOR=_TENSORSHAPEPROTO,
|
||||
__module__="tensorboardX.src.tensor_shape_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.TensorShapeProto)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(TensorShapeProto)
|
||||
_sym_db.RegisterMessage(TensorShapeProto.Dim)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FileOptions(), _b("\n\030org.tensorflow.frameworkB\021TensorShapeProtosP\001\370\001\001")
|
||||
)
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,135 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/types.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import enum_type_wrapper
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/types.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
"\n\x1ctensorboardX/src/types.proto\x12\x0btensorboard*\xc2\x05\n\x08\x44\x61taType\x12\x0e\n\nDT_INVALID\x10\x00\x12\x0c\n\x08\x44T_FLOAT\x10\x01\x12\r\n\tDT_DOUBLE\x10\x02\x12\x0c\n\x08\x44T_INT32\x10\x03\x12\x0c\n\x08\x44T_UINT8\x10\x04\x12\x0c\n\x08\x44T_INT16\x10\x05\x12\x0b\n\x07\x44T_INT8\x10\x06\x12\r\n\tDT_STRING\x10\x07\x12\x10\n\x0c\x44T_COMPLEX64\x10\x08\x12\x0c\n\x08\x44T_INT64\x10\t\x12\x0b\n\x07\x44T_BOOL\x10\n\x12\x0c\n\x08\x44T_QINT8\x10\x0b\x12\r\n\tDT_QUINT8\x10\x0c\x12\r\n\tDT_QINT32\x10\r\x12\x0f\n\x0b\x44T_BFLOAT16\x10\x0e\x12\r\n\tDT_QINT16\x10\x0f\x12\x0e\n\nDT_QUINT16\x10\x10\x12\r\n\tDT_UINT16\x10\x11\x12\x11\n\rDT_COMPLEX128\x10\x12\x12\x0b\n\x07\x44T_HALF\x10\x13\x12\x0f\n\x0b\x44T_RESOURCE\x10\x14\x12\x10\n\x0c\x44T_FLOAT_REF\x10\x65\x12\x11\n\rDT_DOUBLE_REF\x10\x66\x12\x10\n\x0c\x44T_INT32_REF\x10g\x12\x10\n\x0c\x44T_UINT8_REF\x10h\x12\x10\n\x0c\x44T_INT16_REF\x10i\x12\x0f\n\x0b\x44T_INT8_REF\x10j\x12\x11\n\rDT_STRING_REF\x10k\x12\x14\n\x10\x44T_COMPLEX64_REF\x10l\x12\x10\n\x0c\x44T_INT64_REF\x10m\x12\x0f\n\x0b\x44T_BOOL_REF\x10n\x12\x10\n\x0c\x44T_QINT8_REF\x10o\x12\x11\n\rDT_QUINT8_REF\x10p\x12\x11\n\rDT_QINT32_REF\x10q\x12\x13\n\x0f\x44T_BFLOAT16_REF\x10r\x12\x11\n\rDT_QINT16_REF\x10s\x12\x12\n\x0e\x44T_QUINT16_REF\x10t\x12\x11\n\rDT_UINT16_REF\x10u\x12\x15\n\x11\x44T_COMPLEX128_REF\x10v\x12\x0f\n\x0b\x44T_HALF_REF\x10w\x12\x13\n\x0f\x44T_RESOURCE_REF\x10xB,\n\x18org.tensorflow.frameworkB\x0bTypesProtosP\x01\xf8\x01\x01\x62\x06proto3"
|
||||
),
|
||||
)
|
||||
|
||||
_DATATYPE = _descriptor.EnumDescriptor(
|
||||
name="DataType",
|
||||
full_name="tensorboard.DataType",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(name="DT_INVALID", index=0, number=0, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_FLOAT", index=1, number=1, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_DOUBLE", index=2, number=2, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_INT32", index=3, number=3, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_UINT8", index=4, number=4, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_INT16", index=5, number=5, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_INT8", index=6, number=6, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_STRING", index=7, number=7, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_COMPLEX64", index=8, number=8, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_INT64", index=9, number=9, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_BOOL", index=10, number=10, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_QINT8", index=11, number=11, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_QUINT8", index=12, number=12, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_QINT32", index=13, number=13, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_BFLOAT16", index=14, number=14, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_QINT16", index=15, number=15, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_QUINT16", index=16, number=16, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_UINT16", index=17, number=17, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_COMPLEX128", index=18, number=18, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_HALF", index=19, number=19, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_RESOURCE", index=20, number=20, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_FLOAT_REF", index=21, number=101, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_DOUBLE_REF", index=22, number=102, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_INT32_REF", index=23, number=103, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_UINT8_REF", index=24, number=104, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_INT16_REF", index=25, number=105, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_INT8_REF", index=26, number=106, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_STRING_REF", index=27, number=107, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_COMPLEX64_REF", index=28, number=108, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_INT64_REF", index=29, number=109, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_BOOL_REF", index=30, number=110, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_QINT8_REF", index=31, number=111, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_QUINT8_REF", index=32, number=112, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_QINT32_REF", index=33, number=113, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_BFLOAT16_REF", index=34, number=114, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_QINT16_REF", index=35, number=115, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_QUINT16_REF", index=36, number=116, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_UINT16_REF", index=37, number=117, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_COMPLEX128_REF", index=38, number=118, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_HALF_REF", index=39, number=119, options=None, type=None),
|
||||
_descriptor.EnumValueDescriptor(name="DT_RESOURCE_REF", index=40, number=120, options=None, type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=46,
|
||||
serialized_end=752,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_DATATYPE)
|
||||
|
||||
DataType = enum_type_wrapper.EnumTypeWrapper(_DATATYPE)
|
||||
DT_INVALID = 0
|
||||
DT_FLOAT = 1
|
||||
DT_DOUBLE = 2
|
||||
DT_INT32 = 3
|
||||
DT_UINT8 = 4
|
||||
DT_INT16 = 5
|
||||
DT_INT8 = 6
|
||||
DT_STRING = 7
|
||||
DT_COMPLEX64 = 8
|
||||
DT_INT64 = 9
|
||||
DT_BOOL = 10
|
||||
DT_QINT8 = 11
|
||||
DT_QUINT8 = 12
|
||||
DT_QINT32 = 13
|
||||
DT_BFLOAT16 = 14
|
||||
DT_QINT16 = 15
|
||||
DT_QUINT16 = 16
|
||||
DT_UINT16 = 17
|
||||
DT_COMPLEX128 = 18
|
||||
DT_HALF = 19
|
||||
DT_RESOURCE = 20
|
||||
DT_FLOAT_REF = 101
|
||||
DT_DOUBLE_REF = 102
|
||||
DT_INT32_REF = 103
|
||||
DT_UINT8_REF = 104
|
||||
DT_INT16_REF = 105
|
||||
DT_INT8_REF = 106
|
||||
DT_STRING_REF = 107
|
||||
DT_COMPLEX64_REF = 108
|
||||
DT_INT64_REF = 109
|
||||
DT_BOOL_REF = 110
|
||||
DT_QINT8_REF = 111
|
||||
DT_QUINT8_REF = 112
|
||||
DT_QINT32_REF = 113
|
||||
DT_BFLOAT16_REF = 114
|
||||
DT_QINT16_REF = 115
|
||||
DT_QUINT16_REF = 116
|
||||
DT_UINT16_REF = 117
|
||||
DT_COMPLEX128_REF = 118
|
||||
DT_HALF_REF = 119
|
||||
DT_RESOURCE_REF = 120
|
||||
|
||||
|
||||
DESCRIPTOR.enum_types_by_name["DataType"] = _DATATYPE
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FileOptions(), _b("\n\030org.tensorflow.frameworkB\013TypesProtosP\001\370\001\001")
|
||||
)
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,118 +0,0 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: tensorboardX/src/versions.proto
|
||||
|
||||
import sys
|
||||
|
||||
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name="tensorboardX/src/versions.proto",
|
||||
package="tensorboard",
|
||||
syntax="proto3",
|
||||
serialized_pb=_b(
|
||||
'\n\x1ftensorboardX/src/versions.proto\x12\x0btensorboard"K\n\nVersionDef\x12\x10\n\x08producer\x18\x01 \x01(\x05\x12\x14\n\x0cmin_consumer\x18\x02 \x01(\x05\x12\x15\n\rbad_consumers\x18\x03 \x03(\x05\x42/\n\x18org.tensorflow.frameworkB\x0eVersionsProtosP\x01\xf8\x01\x01\x62\x06proto3'
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
_VERSIONDEF = _descriptor.Descriptor(
|
||||
name="VersionDef",
|
||||
full_name="tensorboard.VersionDef",
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name="producer",
|
||||
full_name="tensorboard.VersionDef.producer",
|
||||
index=0,
|
||||
number=1,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="min_consumer",
|
||||
full_name="tensorboard.VersionDef.min_consumer",
|
||||
index=1,
|
||||
number=2,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=1,
|
||||
has_default_value=False,
|
||||
default_value=0,
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
_descriptor.FieldDescriptor(
|
||||
name="bad_consumers",
|
||||
full_name="tensorboard.VersionDef.bad_consumers",
|
||||
index=2,
|
||||
number=3,
|
||||
type=5,
|
||||
cpp_type=1,
|
||||
label=3,
|
||||
has_default_value=False,
|
||||
default_value=[],
|
||||
message_type=None,
|
||||
enum_type=None,
|
||||
containing_type=None,
|
||||
is_extension=False,
|
||||
extension_scope=None,
|
||||
options=None,
|
||||
),
|
||||
],
|
||||
extensions=[],
|
||||
nested_types=[],
|
||||
enum_types=[],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax="proto3",
|
||||
extension_ranges=[],
|
||||
oneofs=[],
|
||||
serialized_start=48,
|
||||
serialized_end=123,
|
||||
)
|
||||
|
||||
DESCRIPTOR.message_types_by_name["VersionDef"] = _VERSIONDEF
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
VersionDef = _reflection.GeneratedProtocolMessageType(
|
||||
"VersionDef",
|
||||
(_message.Message,),
|
||||
dict(
|
||||
DESCRIPTOR=_VERSIONDEF,
|
||||
__module__="tensorboardX.src.versions_pb2"
|
||||
# @@protoc_insertion_point(class_scope:tensorboard.VersionDef)
|
||||
),
|
||||
)
|
||||
_sym_db.RegisterMessage(VersionDef)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(
|
||||
descriptor_pb2.FileOptions(), _b("\n\030org.tensorflow.frameworkB\016VersionsProtosP\001\370\001\001")
|
||||
)
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -1,269 +0,0 @@
|
||||
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ==============================================================================
|
||||
|
||||
"""## Generation of summaries.
|
||||
### Class for writing Summaries
|
||||
@@FileWriter
|
||||
@@FileWriterCache
|
||||
### Summary Ops
|
||||
@@tensor_summary
|
||||
@@scalar
|
||||
@@histogram
|
||||
@@audio
|
||||
@@image
|
||||
@@merge
|
||||
@@merge_all
|
||||
## Utilities
|
||||
@@get_summary_description
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import bisect
|
||||
import logging
|
||||
import re as _re
|
||||
|
||||
import numpy as np
|
||||
from six import StringIO
|
||||
from six.moves import range
|
||||
|
||||
from .src.plugin_pr_curve_pb2 import PrCurvePluginData
|
||||
|
||||
# pylint: disable=unused-import
|
||||
from .src.summary_pb2 import HistogramProto, Summary, SummaryMetadata
|
||||
from .src.tensor_pb2 import TensorProto
|
||||
from .src.tensor_shape_pb2 import TensorShapeProto
|
||||
from .x2num import makenp
|
||||
|
||||
_INVALID_TAG_CHARACTERS = _re.compile(r"[^-/\w\.]")
|
||||
|
||||
|
||||
def _clean_tag(name):
|
||||
# In the past, the first argument to summary ops was a tag, which allowed
|
||||
# arbitrary characters. Now we are changing the first argument to be the node
|
||||
# name. This has a number of advantages (users of summary ops now can
|
||||
# take advantage of the tf name scope system) but risks breaking existing
|
||||
# usage, because a much smaller set of characters are allowed in node names.
|
||||
# This function replaces all illegal characters with _s, and logs a warning.
|
||||
# It also strips leading slashes from the name.
|
||||
if name is not None:
|
||||
new_name = _INVALID_TAG_CHARACTERS.sub("_", name)
|
||||
new_name = new_name.lstrip("/") # Remove leading slashes
|
||||
if new_name != name:
|
||||
logging.info("Summary name %s is illegal; using %s instead." % (name, new_name))
|
||||
name = new_name
|
||||
return name
|
||||
|
||||
|
||||
def scalar(name, scalar, collections=None):
|
||||
"""Outputs a `Summary` protocol buffer containing a single scalar value.
|
||||
The generated Summary has a Tensor.proto containing the input Tensor.
|
||||
Args:
|
||||
name: A name for the generated node. Will also serve as the series name in
|
||||
TensorBoard.
|
||||
tensor: A real numeric Tensor containing a single value.
|
||||
collections: Optional list of graph collections keys. The new summary op is
|
||||
added to these collections. Defaults to `[GraphKeys.SUMMARIES]`.
|
||||
Returns:
|
||||
A scalar `Tensor` of type `string`. Which contains a `Summary` protobuf.
|
||||
Raises:
|
||||
ValueError: If tensor has the wrong shape or type.
|
||||
"""
|
||||
name = _clean_tag(name)
|
||||
scalar = makenp(scalar)
|
||||
assert scalar.squeeze().ndim == 0, "scalar should be 0D"
|
||||
scalar = float(scalar)
|
||||
return Summary(value=[Summary.Value(tag=name, simple_value=scalar)])
|
||||
|
||||
|
||||
def histogram(name, values, bins, collections=None):
|
||||
# pylint: disable=line-too-long
|
||||
"""Outputs a `Summary` protocol buffer with a histogram.
|
||||
The generated
|
||||
[`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto)
|
||||
has one summary value containing a histogram for `values`.
|
||||
This op reports an `InvalidArgument` error if any value is not finite.
|
||||
Args:
|
||||
name: A name for the generated node. Will also serve as a series name in
|
||||
TensorBoard.
|
||||
values: A real numeric `Tensor`. Any shape. Values to use to
|
||||
build the histogram.
|
||||
collections: Optional list of graph collections keys. The new summary op is
|
||||
added to these collections. Defaults to `[GraphKeys.SUMMARIES]`.
|
||||
Returns:
|
||||
A scalar `Tensor` of type `string`. The serialized `Summary` protocol
|
||||
buffer.
|
||||
"""
|
||||
name = _clean_tag(name)
|
||||
values = makenp(values)
|
||||
hist = make_histogram(values.astype(float), bins)
|
||||
return Summary(value=[Summary.Value(tag=name, histo=hist)])
|
||||
|
||||
|
||||
def make_histogram(values, bins):
|
||||
"""Convert values into a histogram proto using logic from histogram.cc."""
|
||||
values = values.reshape(-1)
|
||||
counts, limits = np.histogram(values, bins=bins)
|
||||
limits = limits[1:]
|
||||
|
||||
sum_sq = values.dot(values)
|
||||
return HistogramProto(
|
||||
min=values.min(),
|
||||
max=values.max(),
|
||||
num=len(values),
|
||||
sum=values.sum(),
|
||||
sum_squares=sum_sq,
|
||||
bucket_limit=limits,
|
||||
bucket=counts,
|
||||
)
|
||||
|
||||
|
||||
def image(tag, tensor):
|
||||
"""Outputs a `Summary` protocol buffer with images.
|
||||
The summary has up to `max_images` summary values containing images. The
|
||||
images are built from `tensor` which must be 3-D with shape `[height, width,
|
||||
channels]` and where `channels` can be:
|
||||
* 1: `tensor` is interpreted as Grayscale.
|
||||
* 3: `tensor` is interpreted as RGB.
|
||||
* 4: `tensor` is interpreted as RGBA.
|
||||
The `name` in the outputted Summary.Value protobufs is generated based on the
|
||||
name, with a suffix depending on the max_outputs setting:
|
||||
* If `max_outputs` is 1, the summary value tag is '*name*/image'.
|
||||
* If `max_outputs` is greater than 1, the summary value tags are
|
||||
generated sequentially as '*name*/image/0', '*name*/image/1', etc.
|
||||
Args:
|
||||
tag: A name for the generated node. Will also serve as a series name in
|
||||
TensorBoard.
|
||||
tensor: A 3-D `uint8` or `float32` `Tensor` of shape `[height, width,
|
||||
channels]` where `channels` is 1, 3, or 4.
|
||||
Returns:
|
||||
A scalar `Tensor` of type `string`. The serialized `Summary` protocol
|
||||
buffer.
|
||||
"""
|
||||
tag = _clean_tag(tag)
|
||||
tensor = makenp(tensor, "IMG")
|
||||
tensor = tensor.astype(np.float32)
|
||||
tensor = (tensor * 255).astype(np.uint8)
|
||||
image = make_image(tensor)
|
||||
return Summary(value=[Summary.Value(tag=tag, image=image)])
|
||||
|
||||
|
||||
def make_image(tensor):
|
||||
"""Convert an numpy representation image to Image protobuf"""
|
||||
from PIL import Image
|
||||
|
||||
height, width, channel = tensor.shape
|
||||
image = Image.fromarray(tensor)
|
||||
import io
|
||||
|
||||
output = io.BytesIO()
|
||||
image.save(output, format="PNG")
|
||||
image_string = output.getvalue()
|
||||
output.close()
|
||||
return Summary.Image(height=height, width=width, colorspace=channel, encoded_image_string=image_string)
|
||||
|
||||
|
||||
def audio(tag, tensor, sample_rate=44100):
|
||||
tensor = makenp(tensor)
|
||||
tensor = tensor.squeeze()
|
||||
if abs(tensor).max() > 1:
|
||||
print("warning: audio amplitude out of range, auto clipped.")
|
||||
tensor = tensor.clip(-1, 1)
|
||||
assert tensor.ndim == 1, "input tensor should be 1 dimensional."
|
||||
|
||||
tensor_list = [int(32767.0 * x) for x in tensor]
|
||||
import io
|
||||
import struct
|
||||
import wave
|
||||
|
||||
fio = io.BytesIO()
|
||||
Wave_write = wave.open(fio, "wb")
|
||||
Wave_write.setnchannels(1)
|
||||
Wave_write.setsampwidth(2)
|
||||
Wave_write.setframerate(sample_rate)
|
||||
tensor_enc = b""
|
||||
for v in tensor_list:
|
||||
tensor_enc += struct.pack("<h", v)
|
||||
|
||||
Wave_write.writeframes(tensor_enc)
|
||||
Wave_write.close()
|
||||
audio_string = fio.getvalue()
|
||||
fio.close()
|
||||
audio = Summary.Audio(
|
||||
sample_rate=sample_rate,
|
||||
num_channels=1,
|
||||
length_frames=len(tensor_list),
|
||||
encoded_audio_string=audio_string,
|
||||
content_type="audio/wav",
|
||||
)
|
||||
return Summary(value=[Summary.Value(tag=tag, audio=audio)])
|
||||
|
||||
|
||||
def text(tag, text):
|
||||
import json
|
||||
|
||||
PluginData = [SummaryMetadata.PluginData(plugin_name="text")]
|
||||
smd = SummaryMetadata(plugin_data=PluginData)
|
||||
tensor = TensorProto(
|
||||
dtype="DT_STRING",
|
||||
string_val=[text.encode(encoding="utf_8")],
|
||||
tensor_shape=TensorShapeProto(dim=[TensorShapeProto.Dim(size=1)]),
|
||||
)
|
||||
return Summary(value=[Summary.Value(node_name=tag, metadata=smd, tensor=tensor)])
|
||||
|
||||
|
||||
def pr_curve(tag, labels, predictions, num_thresholds=127, weights=None):
|
||||
if num_thresholds > 127: # wierd, value > 127 breaks protobuf
|
||||
num_thresholds = 127
|
||||
data = compute_curve(labels, predictions, num_thresholds=num_thresholds, weights=weights)
|
||||
pr_curve_plugin_data = PrCurvePluginData(version=0, num_thresholds=num_thresholds).SerializeToString()
|
||||
PluginData = [SummaryMetadata.PluginData(plugin_name="pr_curves", content=pr_curve_plugin_data)]
|
||||
smd = SummaryMetadata(plugin_data=PluginData)
|
||||
tensor = TensorProto(
|
||||
dtype="DT_FLOAT",
|
||||
float_val=data.reshape(-1).tolist(),
|
||||
tensor_shape=TensorShapeProto(
|
||||
dim=[TensorShapeProto.Dim(size=data.shape[0]), TensorShapeProto.Dim(size=data.shape[1])]
|
||||
),
|
||||
)
|
||||
return Summary(value=[Summary.Value(tag=tag, metadata=smd, tensor=tensor)])
|
||||
|
||||
|
||||
# https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/pr_curve/summary.py
|
||||
def compute_curve(labels, predictions, num_thresholds=None, weights=None):
|
||||
_MINIMUM_COUNT = 1e-7
|
||||
|
||||
if weights is None:
|
||||
weights = 1.0
|
||||
|
||||
# Compute bins of true positives and false positives.
|
||||
bucket_indices = np.int32(np.floor(predictions * (num_thresholds - 1)))
|
||||
float_labels = labels.astype(np.float)
|
||||
histogram_range = (0, num_thresholds - 1)
|
||||
tp_buckets, _ = np.histogram(
|
||||
bucket_indices, bins=num_thresholds, range=histogram_range, weights=float_labels * weights
|
||||
)
|
||||
fp_buckets, _ = np.histogram(
|
||||
bucket_indices, bins=num_thresholds, range=histogram_range, weights=(1.0 - float_labels) * weights
|
||||
)
|
||||
|
||||
# Obtain the reverse cumulative sum.
|
||||
tp = np.cumsum(tp_buckets[::-1])[::-1]
|
||||
fp = np.cumsum(fp_buckets[::-1])[::-1]
|
||||
tn = fp[0] - fp
|
||||
fn = tp[0] - tp
|
||||
precision = tp / np.maximum(_MINIMUM_COUNT, tp + fp)
|
||||
recall = tp / np.maximum(_MINIMUM_COUNT, tp + fn)
|
||||
return np.stack((tp, fp, tn, fn, precision, recall))
|
||||
@@ -1,482 +0,0 @@
|
||||
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ==============================================================================
|
||||
"""Provides an API for generating Event protocol buffers."""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
|
||||
from .embedding import append_pbtxt, make_mat, make_sprite, make_tsv
|
||||
from .event_file_writer import EventFileWriter
|
||||
from .graph import graph
|
||||
from .graph_onnx import gg
|
||||
from .src import event_pb2, graph_pb2, summary_pb2
|
||||
from .summary import audio, histogram, image, pr_curve, scalar, text
|
||||
|
||||
|
||||
class SummaryToEventTransformer(object):
|
||||
"""Abstractly implements the SummaryWriter API.
|
||||
This API basically implements a number of endpoints (add_summary,
|
||||
add_session_log, etc). The endpoints all generate an event protobuf, which is
|
||||
passed to the contained event_writer.
|
||||
@@__init__
|
||||
@@add_summary
|
||||
@@add_session_log
|
||||
@@add_graph
|
||||
@@add_meta_graph
|
||||
@@add_run_metadata
|
||||
"""
|
||||
|
||||
def __init__(self, event_writer, graph=None, graph_def=None):
|
||||
"""Creates a `SummaryWriter` and an event file.
|
||||
On construction the summary writer creates a new event file in `logdir`.
|
||||
This event file will contain `Event` protocol buffers constructed when you
|
||||
call one of the following functions: `add_summary()`, `add_session_log()`,
|
||||
`add_event()`, or `add_graph()`.
|
||||
If you pass a `Graph` to the constructor it is added to
|
||||
the event file. (This is equivalent to calling `add_graph()` later).
|
||||
TensorBoard will pick the graph from the file and display it graphically so
|
||||
you can interactively explore the graph you built. You will usually pass
|
||||
the graph from the session in which you launched it:
|
||||
```python
|
||||
...create a graph...
|
||||
# Launch the graph in a session.
|
||||
sess = tf.Session()
|
||||
# Create a summary writer, add the 'graph' to the event file.
|
||||
writer = tf.summary.FileWriter(<some-directory>, sess.graph)
|
||||
```
|
||||
Args:
|
||||
event_writer: An EventWriter. Implements add_event method.
|
||||
graph: A `Graph` object, such as `sess.graph`.
|
||||
graph_def: DEPRECATED: Use the `graph` argument instead.
|
||||
"""
|
||||
self.event_writer = event_writer
|
||||
# For storing used tags for session.run() outputs.
|
||||
self._session_run_tags = {}
|
||||
# TODO(zihaolucky). pass this an empty graph to check whether it's necessary.
|
||||
# currently we don't support graph in MXNet using tensorboard.
|
||||
|
||||
def add_summary(self, summary, global_step=None):
|
||||
"""Adds a `Summary` protocol buffer to the event file.
|
||||
This method wraps the provided summary in an `Event` protocol buffer
|
||||
and adds it to the event file.
|
||||
You can pass the result of evaluating any summary op, using
|
||||
[`Session.run()`](client.md#Session.run) or
|
||||
[`Tensor.eval()`](framework.md#Tensor.eval), to this
|
||||
function. Alternatively, you can pass a `tf.Summary` protocol
|
||||
buffer that you populate with your own data. The latter is
|
||||
commonly done to report evaluation results in event files.
|
||||
Args:
|
||||
summary: A `Summary` protocol buffer, optionally serialized as a string.
|
||||
global_step: Number. Optional global step value to record with the
|
||||
summary.
|
||||
"""
|
||||
if isinstance(summary, bytes):
|
||||
summ = summary_pb2.Summary()
|
||||
summ.ParseFromString(summary)
|
||||
summary = summ
|
||||
event = event_pb2.Event(summary=summary)
|
||||
self._add_event(event, global_step)
|
||||
|
||||
def add_graph_onnx(self, graph):
|
||||
"""Adds a `Graph` protocol buffer to the event file.
|
||||
"""
|
||||
event = event_pb2.Event(graph_def=graph.SerializeToString())
|
||||
self._add_event(event, None)
|
||||
|
||||
def add_graph(self, graph):
|
||||
"""Adds a `Graph` protocol buffer to the event file.
|
||||
"""
|
||||
event = event_pb2.Event(graph_def=graph.SerializeToString())
|
||||
self._add_event(event, None)
|
||||
|
||||
def add_session_log(self, session_log, global_step=None):
|
||||
"""Adds a `SessionLog` protocol buffer to the event file.
|
||||
This method wraps the provided session in an `Event` protocol buffer
|
||||
and adds it to the event file.
|
||||
Args:
|
||||
session_log: A `SessionLog` protocol buffer.
|
||||
global_step: Number. Optional global step value to record with the
|
||||
summary.
|
||||
"""
|
||||
event = event_pb2.Event(session_log=session_log)
|
||||
self._add_event(event, global_step)
|
||||
|
||||
def _add_event(self, event, step):
|
||||
event.wall_time = time.time()
|
||||
if step is not None:
|
||||
event.step = int(step)
|
||||
self.event_writer.add_event(event)
|
||||
|
||||
|
||||
class FileWriter(SummaryToEventTransformer):
|
||||
"""Writes `Summary` protocol buffers to event files.
|
||||
The `FileWriter` class provides a mechanism to create an event file in a
|
||||
given directory and add summaries and events to it. The class updates the
|
||||
file contents asynchronously. This allows a training program to call methods
|
||||
to add data to the file directly from the training loop, without slowing down
|
||||
training.
|
||||
@@__init__
|
||||
@@add_summary
|
||||
@@add_session_log
|
||||
@@add_event
|
||||
@@add_graph
|
||||
@@add_run_metadata
|
||||
@@get_logdir
|
||||
@@flush
|
||||
@@close
|
||||
"""
|
||||
|
||||
def __init__(self, logdir, graph=None, max_queue=10, flush_secs=120, graph_def=None):
|
||||
"""Creates a `FileWriter` and an event file.
|
||||
On construction the summary writer creates a new event file in `logdir`.
|
||||
This event file will contain `Event` protocol buffers constructed when you
|
||||
call one of the following functions: `add_summary()`, `add_session_log()`,
|
||||
`add_event()`, or `add_graph()`.
|
||||
If you pass a `Graph` to the constructor it is added to
|
||||
the event file. (This is equivalent to calling `add_graph()` later).
|
||||
TensorBoard will pick the graph from the file and display it graphically so
|
||||
you can interactively explore the graph you built. You will usually pass
|
||||
the graph from the session in which you launched it:
|
||||
```python
|
||||
...create a graph...
|
||||
# Launch the graph in a session.
|
||||
sess = tf.Session()
|
||||
# Create a summary writer, add the 'graph' to the event file.
|
||||
writer = tf.summary.FileWriter(<some-directory>, sess.graph)
|
||||
```
|
||||
The other arguments to the constructor control the asynchronous writes to
|
||||
the event file:
|
||||
* `flush_secs`: How often, in seconds, to flush the added summaries
|
||||
and events to disk.
|
||||
* `max_queue`: Maximum number of summaries or events pending to be
|
||||
written to disk before one of the 'add' calls block.
|
||||
Args:
|
||||
logdir: A string. Directory where event file will be written.
|
||||
graph: A `Graph` object, such as `sess.graph`.
|
||||
max_queue: Integer. Size of the queue for pending events and summaries.
|
||||
flush_secs: Number. How often, in seconds, to flush the
|
||||
pending events and summaries to disk.
|
||||
graph_def: DEPRECATED: Use the `graph` argument instead.
|
||||
"""
|
||||
event_writer = EventFileWriter(logdir, max_queue, flush_secs)
|
||||
super(FileWriter, self).__init__(event_writer, graph, graph_def)
|
||||
|
||||
def get_logdir(self):
|
||||
"""Returns the directory where event file will be written."""
|
||||
return self.event_writer.get_logdir()
|
||||
|
||||
def add_event(self, event):
|
||||
"""Adds an event to the event file.
|
||||
Args:
|
||||
event: An `Event` protocol buffer.
|
||||
"""
|
||||
self.event_writer.add_event(event)
|
||||
|
||||
def flush(self):
|
||||
"""Flushes the event file to disk.
|
||||
Call this method to make sure that all pending events have been written to
|
||||
disk.
|
||||
"""
|
||||
self.event_writer.flush()
|
||||
|
||||
def close(self):
|
||||
"""Flushes the event file to disk and close the file.
|
||||
Call this method when you do not need the summary writer anymore.
|
||||
"""
|
||||
self.event_writer.close()
|
||||
|
||||
def reopen(self):
|
||||
"""Reopens the EventFileWriter.
|
||||
Can be called after `close()` to add more events in the same directory.
|
||||
The events will go into a new events file.
|
||||
Does nothing if the EventFileWriter was not closed.
|
||||
"""
|
||||
self.event_writer.reopen()
|
||||
|
||||
|
||||
class SummaryWriter(object):
|
||||
"""Writes `Summary` directly to event files.
|
||||
The `SummaryWriter` class provides a high-level api to create an event file in a
|
||||
given directory and add summaries and events to it. The class updates the
|
||||
file contents asynchronously. This allows a training program to call methods
|
||||
to add data to the file directly from the training loop, without slowing down
|
||||
training.
|
||||
"""
|
||||
|
||||
def __init__(self, log_dir=None, comment=""):
|
||||
"""
|
||||
Args:
|
||||
log_dir (string): save location, default is: runs/**CURRENT_DATETIME_HOSTNAME**, which changes after each
|
||||
run. Use hierarchical folder structure to compare between runs easily. e.g. 'runs/exp1', 'runs/exp2'
|
||||
comment (string): comment that appends to the default log_dir
|
||||
"""
|
||||
if not log_dir:
|
||||
import socket
|
||||
from datetime import datetime
|
||||
|
||||
current_time = datetime.now().strftime("%b%d_%H-%M-%S")
|
||||
log_dir = os.path.join("runs", current_time + "_" + socket.gethostname() + comment)
|
||||
self.file_writer = FileWriter(logdir=log_dir)
|
||||
v = 1e-12
|
||||
buckets = []
|
||||
neg_buckets = []
|
||||
while v < 1e20:
|
||||
buckets.append(v)
|
||||
neg_buckets.append(-v)
|
||||
v *= 1.1
|
||||
self.default_bins = neg_buckets[::-1] + [0] + buckets
|
||||
self.text_tags = []
|
||||
#
|
||||
self.all_writers = {self.file_writer.get_logdir(): self.file_writer}
|
||||
self.scalar_dict = {} # {writer_id : [[timestamp, step, value],...],...}
|
||||
|
||||
def __append_to_scalar_dict(self, tag, scalar_value, global_step, timestamp):
|
||||
"""This adds an entry to the self.scalar_dict datastructure with format
|
||||
{writer_id : [[timestamp, step, value], ...], ...}.
|
||||
"""
|
||||
from .x2num import makenp
|
||||
|
||||
if tag not in self.scalar_dict.keys():
|
||||
self.scalar_dict[tag] = []
|
||||
self.scalar_dict[tag].append([timestamp, global_step, float(makenp(scalar_value))])
|
||||
|
||||
def add_scalar(self, tag, scalar_value, global_step=None):
|
||||
"""Add scalar data to summary.
|
||||
|
||||
Args:
|
||||
tag (string): Data identifier
|
||||
scalar_value (float): Value to save
|
||||
global_step (int): Global step value to record
|
||||
"""
|
||||
self.file_writer.add_summary(scalar(tag, scalar_value), global_step)
|
||||
self.__append_to_scalar_dict(tag, scalar_value, global_step, time.time())
|
||||
|
||||
def add_scalars(self, main_tag, tag_scalar_dict, global_step=None):
|
||||
"""Adds many scalar data to summary.
|
||||
|
||||
Args:
|
||||
tag (string): Data identifier
|
||||
main_tag (string): The parent name for the tags
|
||||
tag_scalar_dict (dict): Key-value pair storing the tag and corresponding values
|
||||
global_step (int): Global step value to record
|
||||
|
||||
Examples::
|
||||
|
||||
writer.add_scalars('run_14h',{'xsinx':i*np.sin(i/r),
|
||||
'xcosx':i*np.cos(i/r),
|
||||
'arctanx': numsteps*np.arctan(i/r)}, i)
|
||||
# This function adds three values to the same scalar plot with the tag
|
||||
# 'run_14h' in TensorBoard's scalar section.
|
||||
"""
|
||||
timestamp = time.time()
|
||||
fw_logdir = self.file_writer.get_logdir()
|
||||
for tag, scalar_value in tag_scalar_dict.items():
|
||||
fw_tag = fw_logdir + "/" + main_tag + "/" + tag
|
||||
if fw_tag in self.all_writers.keys():
|
||||
fw = self.all_writers[fw_tag]
|
||||
else:
|
||||
fw = FileWriter(logdir=fw_tag)
|
||||
self.all_writers[fw_tag] = fw
|
||||
fw.add_summary(scalar(main_tag, scalar_value), global_step)
|
||||
self.__append_to_scalar_dict(fw_tag, scalar_value, global_step, timestamp)
|
||||
|
||||
def export_scalars_to_json(self, path):
|
||||
"""Exports to the given path an ASCII file containing all the scalars written
|
||||
so far by this instance, with the following format:
|
||||
{writer_id : [[timestamp, step, value], ...], ...}
|
||||
"""
|
||||
with open(path, "w") as f:
|
||||
json.dump(self.scalar_dict, f)
|
||||
|
||||
def add_histogram(self, tag, values, global_step=None, bins="tensorflow"):
|
||||
"""Add histogram to summary.
|
||||
|
||||
Args:
|
||||
tag (string): Data identifier
|
||||
values (numpy.array): Values to build histogram
|
||||
global_step (int): Global step value to record
|
||||
bins (string): one of {'tensorflow','auto', 'fd', ...}, this determines how the bins are made. You can find
|
||||
other options in: https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html
|
||||
"""
|
||||
if bins == "tensorflow":
|
||||
bins = self.default_bins
|
||||
self.file_writer.add_summary(histogram(tag, values, bins), global_step)
|
||||
|
||||
def add_image(self, tag, img_tensor, global_step=None):
|
||||
"""Add image data to summary.
|
||||
|
||||
Note that this requires the ``pillow`` package.
|
||||
|
||||
Args:
|
||||
tag (string): Data identifier
|
||||
img_tensor (torch.Tensor): Image data
|
||||
global_step (int): Global step value to record
|
||||
Shape:
|
||||
img_tensor: :math:`(3, H, W)`. Use ``torchvision.utils.make_grid()`` to prepare it is a good idea.
|
||||
"""
|
||||
self.file_writer.add_summary(image(tag, img_tensor), global_step)
|
||||
|
||||
def add_audio(self, tag, snd_tensor, global_step=None, sample_rate=44100):
|
||||
"""Add audio data to summary.
|
||||
|
||||
Args:
|
||||
tag (string): Data identifier
|
||||
snd_tensor (torch.Tensor): Sound data
|
||||
global_step (int): Global step value to record
|
||||
sample_rate (int): sample rate in Hz
|
||||
|
||||
Shape:
|
||||
snd_tensor: :math:`(1, L)`. The values should lie between [-1, 1].
|
||||
"""
|
||||
self.file_writer.add_summary(audio(tag, snd_tensor, sample_rate=sample_rate), global_step)
|
||||
|
||||
def add_text(self, tag, text_string, global_step=None):
|
||||
"""Add text data to summary.
|
||||
|
||||
Args:
|
||||
tag (string): Data identifier
|
||||
text_string (string): String to save
|
||||
global_step (int): Global step value to record
|
||||
|
||||
Examples::
|
||||
|
||||
writer.add_text('lstm', 'This is an lstm', 0)
|
||||
writer.add_text('rnn', 'This is an rnn', 10)
|
||||
"""
|
||||
self.file_writer.add_summary(text(tag, text_string), global_step)
|
||||
if tag not in self.text_tags:
|
||||
self.text_tags.append(tag)
|
||||
extension_dir = self.file_writer.get_logdir() + "/plugins/tensorboard_text/"
|
||||
if not os.path.exists(extension_dir):
|
||||
os.makedirs(extension_dir)
|
||||
with open(extension_dir + "tensors.json", "w") as fp:
|
||||
json.dump(self.text_tags, fp)
|
||||
|
||||
def add_graph_onnx(self, prototxt):
|
||||
self.file_writer.add_graph_onnx(gg(prototxt))
|
||||
|
||||
def add_graph(self, model, input_to_model, verbose=False):
|
||||
# prohibit second call?
|
||||
# no, let tensorboard handles it and show its warning message.
|
||||
"""Add graph data to summary.
|
||||
|
||||
Args:
|
||||
model (torch.nn.Module): model to draw.
|
||||
input_to_model (torch.autograd.Variable): a variable or a tuple of variables to be fed.
|
||||
|
||||
"""
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
import torch
|
||||
|
||||
if LooseVersion(torch.__version__) >= LooseVersion("0.3.1"):
|
||||
pass
|
||||
else:
|
||||
if LooseVersion(torch.__version__) >= LooseVersion("0.3.0"):
|
||||
print("You are using PyTorch==0.3.0, use add_graph_onnx()")
|
||||
return
|
||||
if not hasattr(torch.autograd.Variable, "grad_fn"):
|
||||
print("add_graph() only supports PyTorch v0.2.")
|
||||
return
|
||||
self.file_writer.add_graph(graph(model, input_to_model, verbose))
|
||||
|
||||
def add_embedding(self, mat, metadata=None, label_img=None, global_step=None, tag="default"):
|
||||
"""Add embedding projector data to summary.
|
||||
|
||||
Args:
|
||||
mat (torch.Tensor): A matrix which each row is the feature vector of the data point
|
||||
metadata (list): A list of labels, each element will be convert to string
|
||||
label_img (torch.Tensor): Images correspond to each data point
|
||||
global_step (int): Global step value to record
|
||||
tag (string): Name for the embedding
|
||||
Shape:
|
||||
mat: :math:`(N, D)`, where N is number of data and D is feature dimension
|
||||
|
||||
label_img: :math:`(N, C, H, W)`
|
||||
|
||||
Examples::
|
||||
|
||||
import keyword
|
||||
import torch
|
||||
meta = []
|
||||
while len(meta)<100:
|
||||
meta = meta+keyword.kwlist # get some strings
|
||||
meta = meta[:100]
|
||||
|
||||
for i, v in enumerate(meta):
|
||||
meta[i] = v+str(i)
|
||||
|
||||
label_img = torch.rand(100, 3, 10, 32)
|
||||
for i in range(100):
|
||||
label_img[i]*=i/100.0
|
||||
|
||||
writer.add_embedding(torch.randn(100, 5), metadata=meta, label_img=label_img)
|
||||
writer.add_embedding(torch.randn(100, 5), label_img=label_img)
|
||||
writer.add_embedding(torch.randn(100, 5), metadata=meta)
|
||||
"""
|
||||
if global_step is None:
|
||||
global_step = 0
|
||||
# clear pbtxt?
|
||||
save_path = os.path.join(self.file_writer.get_logdir(), str(global_step).zfill(5))
|
||||
try:
|
||||
os.makedirs(save_path)
|
||||
except OSError:
|
||||
print("warning: Embedding dir exists, did you set global_step for add_embedding()?")
|
||||
if metadata is not None:
|
||||
assert mat.size(0) == len(metadata), "#labels should equal with #data points"
|
||||
make_tsv(metadata, save_path)
|
||||
if label_img is not None:
|
||||
assert mat.size(0) == label_img.size(0), "#images should equal with #data points"
|
||||
make_sprite(label_img, save_path)
|
||||
assert mat.dim() == 2, "mat should be 2D, where mat.size(0) is the number of data points"
|
||||
make_mat(mat.tolist(), save_path)
|
||||
# new funcion to append to the config file a new embedding
|
||||
append_pbtxt(metadata, label_img, self.file_writer.get_logdir(), str(global_step).zfill(5), tag)
|
||||
|
||||
def add_pr_curve(self, tag, labels, predictions, global_step=None, num_thresholds=127, weights=None):
|
||||
"""Adds precision recall curve.
|
||||
|
||||
Args:
|
||||
tag (string): Data identifier
|
||||
labels (torch.Tensor): Ground truth data. Binary label for each element.
|
||||
predictions (torch.Tensor): The probability that an element be classified as true. Value should in [0, 1]
|
||||
global_step (int): Global step value to record
|
||||
num_thresholds (int): Number of thresholds used to draw the curve.
|
||||
|
||||
"""
|
||||
from .x2num import makenp
|
||||
|
||||
labels = makenp(labels)
|
||||
predictions = makenp(predictions)
|
||||
self.file_writer.add_summary(pr_curve(tag, labels, predictions, num_thresholds, weights), global_step)
|
||||
|
||||
def close(self):
|
||||
if self.file_writer is None:
|
||||
return # ignore double close
|
||||
self.file_writer.flush()
|
||||
self.file_writer.close()
|
||||
for path, writer in self.all_writers.items():
|
||||
writer.flush()
|
||||
writer.close()
|
||||
self.file_writer = self.all_writers = None
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
self.close()
|
||||
@@ -1,93 +0,0 @@
|
||||
# DO NOT alter/distruct/free input object !
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
def makenp(x, modality=None):
|
||||
# if already numpy, return
|
||||
if isinstance(x, np.ndarray):
|
||||
if modality == "IMG" and x.dtype == np.uint8:
|
||||
return x.astype(np.float32) / 255.0
|
||||
return x
|
||||
if np.isscalar(x):
|
||||
return np.array([x])
|
||||
if "torch" in str(type(x)):
|
||||
return pytorch_np(x, modality)
|
||||
if "chainer" in str(type(x)):
|
||||
return chainer_np(x, modality)
|
||||
if "mxnet" in str(type(x)):
|
||||
return mxnet_np(x, modality)
|
||||
|
||||
|
||||
def pytorch_np(x, modality):
|
||||
import torch
|
||||
|
||||
if isinstance(x, torch.autograd.Variable):
|
||||
x = x.data
|
||||
x = x.cpu().numpy()
|
||||
if modality == "IMG":
|
||||
x = _prepare_image(x)
|
||||
return x
|
||||
|
||||
|
||||
def theano_np(x):
|
||||
import theano
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def caffe2_np(x):
|
||||
pass
|
||||
|
||||
|
||||
def mxnet_np(x, modality):
|
||||
x = x.asnumpy()
|
||||
if modality == "IMG":
|
||||
x = _prepare_image(x)
|
||||
return x
|
||||
|
||||
|
||||
def chainer_np(x, modality):
|
||||
import chainer
|
||||
|
||||
x = chainer.cuda.to_cpu(x.data)
|
||||
if modality == "IMG":
|
||||
x = _prepare_image(x)
|
||||
return x
|
||||
|
||||
|
||||
def make_grid(I, ncols=8):
|
||||
assert isinstance(I, np.ndarray), "plugin error, should pass numpy array here"
|
||||
assert I.ndim == 4 and I.shape[1] == 3
|
||||
nimg = I.shape[0]
|
||||
H = I.shape[2]
|
||||
W = I.shape[3]
|
||||
ncols = min(nimg, ncols)
|
||||
nrows = int(np.ceil(float(nimg) / ncols))
|
||||
canvas = np.zeros((3, H * nrows, W * ncols))
|
||||
i = 0
|
||||
for y in range(nrows):
|
||||
for x in range(ncols):
|
||||
if i >= nimg:
|
||||
break
|
||||
canvas[:, y * H : (y + 1) * H, x * W : (x + 1) * W] = I[i]
|
||||
i = i + 1
|
||||
return canvas
|
||||
|
||||
|
||||
def _prepare_image(I):
|
||||
assert isinstance(I, np.ndarray), "plugin error, should pass numpy array here"
|
||||
assert I.ndim == 2 or I.ndim == 3 or I.ndim == 4
|
||||
if I.ndim == 4: # NCHW
|
||||
if I.shape[1] == 1: # N1HW
|
||||
I = np.concatenate((I, I, I), 1) # N3HW
|
||||
assert I.shape[1] == 3
|
||||
I = make_grid(I) # 3xHxW
|
||||
if I.ndim == 3 and I.shape[0] == 1: # 1xHxW
|
||||
I = np.concatenate((I, I, I), 0) # 3xHxW
|
||||
if I.ndim == 2: # HxW
|
||||
I = np.expand_dims(I, 0) # 1xHxW
|
||||
I = np.concatenate((I, I, I), 0) # 3xHxW
|
||||
I = I.transpose(1, 2, 0)
|
||||
|
||||
return I
|
||||
Reference in New Issue
Block a user