Skip to content

Commit

Permalink
add some documents and minor fixes (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanpa committed Oct 22, 2019
1 parent c9ecc54 commit d8c3aa7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dist
*.egg-info
runs/*
*.pyc
mnist
8 changes: 7 additions & 1 deletion run_pytest.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
pip install pytest boto3 moto onnx tensorboard matplotlib

PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python pytest
if [ `ps|grep visdom |wc -l` = "1" ]
then
echo `ps|grep visdom |wc -l`
echo "no visdom"
visdom &
fi

PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python pytest
20 changes: 18 additions & 2 deletions tensorboardX/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,20 @@ def add_text(self, tag, text_string, global_step=None, walltime=None):
self._get_file_writer().add_summary(
text(tag, text_string), global_step, walltime)

def add_onnx_graph(self, prototxt):
self._get_file_writer().add_onnx_graph(load_onnx_graph(prototxt))
def add_onnx_graph(self, onnx_model_file):
"""Add onnx graph to TensorBoard.
Args:
onnx_model_file (string): The path to the onnx model.
"""
self._get_file_writer().add_onnx_graph(load_onnx_graph(onnx_model_file))

def add_openvino_graph(self, xmlname):
"""Add openvino graph to TensorBoard.
Args:
xmlname (string): The path to the openvino model. (the xml file)
"""
self._get_file_writer().add_openvino_graph(load_openvino_graph(xmlname))

def add_graph(self, model, input_to_model=None, verbose=False, **kwargs):
Expand Down Expand Up @@ -1060,6 +1070,9 @@ def add_mesh(self, tag, vertices, colors=None, faces=None, config_dict=None, glo
self._get_file_writer().add_summary(mesh(tag, vertices, colors, faces, config_dict), global_step, walltime)

def close(self):
"""Close the current SummaryWriter. This call flushes the unfinished write operation.
Use context manager (with statement) whenever it's possible.
"""
if self.all_writers is None:
return # ignore double close
for writer in self.all_writers.values():
Expand All @@ -1068,6 +1081,9 @@ def close(self):
self.file_writer = self.all_writers = None

def flush(self):
"""Force the data in memory to be flushed to disk. Use this call if tensorboard does not update reqularly.
Another way is to set the `flush_secs` when creating the SummaryWriter.
"""
if self.all_writers is None:
return # ignore double close
for writer in self.all_writers.values():
Expand Down

0 comments on commit d8c3aa7

Please sign in to comment.