A visualization tool to show a TensorFlow's graph like TensorBoard

Overview

tfgraphviz

GitHub license

tfgraphviz is a module to visualize a TensorFlow's data flow graph like TensorBoard using Graphviz. tfgraphviz enables to provide a visualization of tensorflow graph on Jupyter Notebook without TensorBoard.

Links

Installation

Use pip to install:

$ pip install graphviz
$ pip install tfgraphviz

The only dependency is Graphviz.

macOS:

$ brew install graphviz

Ubuntu:

$ apt-get install graphviz

Quickstart

import tensorflow as tf
import tfgraphviz as tfg

g = tf.Graph()
with g.as_default():
    a = tf.constant(1, name="a")
    b = tf.constant(2, name="b")
    c = tf.add(a, b, name="add")
tfg.board(g)

https://raw.githubusercontent.com/akimach/tfgraphviz/master/img/graph.jpg

License

This package is distributed under the MIT license.

Author

Akimasa KIMURA

Comments
  • Add Binder support

    Add Binder support

    To get the example working in Binder the only required pip installable package is tensorflow and from apt-get is graphviz. The postBuild will install tfgraphviz from GitHub so that it always gets the master HEAD, so that if there is something broken for a bit on PyPI it won't continue to be a problem until a new release is made.

    opened by matthewfeickert 2
  • added pan and zoom support for jupyter

    added pan and zoom support for jupyter

    Added tfg.jupyter_pan_and_zoom helper to wrap generated SVG object In order to enable pan and zoom functionality in Jupyter:

    tfg.jupyter_pan_and_zoom(tfg.board(graph))
    

    Tested in JupyterLab and Colab.

    opened by vlasenkoalexey 1
  • Extending functionality

    Extending functionality

    • Added proper tooltips
    • Fixed logic to render function names to check op type, not op name
    • Added ability to override functions to create digraph, node and edge like:
    def custom_add_digraph_node(digraph, name, op, attributes=None):
        attributes=[]
        if op is not None and 'PartitionedCall' in op.type:
            attributes.append(('fillcolor', 'blue'))
        tfg.add_digraph_node(digraph, name, op, attributes)
    
    tfg.board(tf_g, depth=10, name_regex=".*", add_digraph_node_func=custom_add_digraph_node)
    
    opened by vlasenkoalexey 1
  • For Python3.x

    For Python3.x

    Fixed to work on Python 3.x:

    • Change IMPLICIT relative imports (from graphviz_wrapper import board) to EXPLICIT relative imports (from .graphviz_wrapper import board).
    • (In addition, ) remove unnecessary imports.

    Checked to work both Python 2.7.x/3.5.x with TensorFlow 1.0.

    opened by antimon2 1
  • UnicodeDecodeError on loading the graph.

    UnicodeDecodeError on loading the graph.

    I am getting the following error. Is unicode in tf variable/scope names not supported?

    <ipython-input-2-b2099ef84663> in load(self)
        143         # sess = tf.Session(graph=tf.get_default_graph())
        144         self.sess.run(self.init)
    --> 145         g = tfg.board(tf.get_default_graph())
        146         g.view()
        147         self.saver.restore(self.sess, model_path)
    
    /Users/activeai/.local/share/virtualenvs/spotter-67LXOL6z/lib/python2.7/site-packages/tfgraphviz/graphviz_wrapper.pyc in board(tfgraph, depth, name, style)
        212     _node_inpt_table, _node_inpt_shape_table = node_input_table(tfgraph, depth=depth)
        213     digraph = add_nodes(_node_table, name=name, style=style)
    --> 214     digraph = add_edges(digraph, _node_inpt_table, _node_inpt_shape_table)
        215     return digraph
    
    /Users/activeai/.local/share/virtualenvs/spotter-67LXOL6z/lib/python2.7/site-packages/tfgraphviz/graphviz_wrapper.pyc in add_edges(digraph, node_inpt_table, node_inpt_shape_table)
        195             else:
        196                 shape = node_inpt_shape_table[ni]
    --> 197                 digraph.edge(ni, node, label=edge_label(shape))
        198     return digraph
        199 
    
    /Users/activeai/.local/share/virtualenvs/spotter-67LXOL6z/lib/python2.7/site-packages/graphviz/dot.pyc in edge(self, tail_name, head_name, label, _attributes, **attrs)
        145         head_name = self._quote_edge(head_name)
        146         attr_list = self._attr_list(label, attrs, _attributes)
    --> 147         line = self._edge % (tail_name, head_name, attr_list)
        148         self.body.append(line)
        149 
    
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128)
    
    opened by malarinv 0
Releases(0.0.8)
Multi-agent reinforcement learning algorithm and environment

Multi-agent reinforcement learning algorithm and environment [en/cn] Pytorch implements multi-agent reinforcement learning algorithms including IQL, Q

万鲲鹏 7 Sep 20, 2022
Space Ship Simulator using python

FlyOver Basic space-ship simulator using python How to run? Just double click run.py What modules do i need? All modules that i currently using is bui

0 Oct 09, 2022
The Official PyTorch Implementation of "VAEBM: A Symbiosis between Variational Autoencoders and Energy-based Models" (ICLR 2021 spotlight paper)

Official PyTorch implementation of "VAEBM: A Symbiosis between Variational Autoencoders and Energy-based Models" (ICLR 2021 Spotlight Paper) Zhisheng

NVIDIA Research Projects 45 Dec 26, 2022
This is an official implementation for "Swin Transformer: Hierarchical Vision Transformer using Shifted Windows" on Semantic Segmentation.

Swin Transformer for Semantic Segmentation of satellite images This repo contains the supported code and configuration files to reproduce semantic seg

23 Oct 10, 2022
TorchX: A PyTorch Extension Library for More Efficient Deep Learning

TorchX TorchX: A PyTorch Extension Library for More Efficient Deep Learning. @misc{torchx, author = {Ansheng You and Changxu Wang}, title = {T

Donny You 8 May 28, 2022
Codebase for Inducing Causal Structure for Interpretable Neural Networks

Interchange Intervention Training (IIT) Codebase for Inducing Causal Structure for Interpretable Neural Networks Release Notes 12/01/2021: Code and Pa

Zen 6 Oct 10, 2022
Language-Agnostic Website Embedding and Classification

Homepage2Vec Language-Agnostic Website Embedding and Classification based on Curlie labels https://arxiv.org/pdf/2201.03677.pdf Homepage2Vec is a pre-

25 Dec 27, 2022
A public available dataset for road boundary detection in aerial images

Topo-boundary This is the official github repo of paper Topo-boundary: A Benchmark Dataset on Topological Road-boundary Detection Using Aerial Images

Zhenhua Xu 79 Jan 04, 2023
Pydantic models for pywttr and aiopywttr.

Pydantic models for pywttr and aiopywttr.

Almaz 2 Dec 08, 2022
Repository for publicly available deep learning models developed in Rosetta community

trRosetta2 This package contains deep learning models and related scripts used by Baker group in CASP14. Installation Linux/Mac clone the package git

81 Dec 29, 2022
Code for "Retrieving Black-box Optimal Images from External Databases" (WSDM 2022)

Retrieving Black-box Optimal Images from External Databases (WSDM 2022) We propose how a user retreives an optimal image from external databases of we

joisino 5 Apr 13, 2022
Neural Point-Based Graphics

Neural Point-Based Graphics Project   Video   Paper Neural Point-Based Graphics Kara-Ali Aliev1 Artem Sevastopolsky1,2 Maria Kolos1,2 Dmitry Ulyanov3

Ali Aliev 252 Dec 13, 2022
StarGAN - Official PyTorch Implementation (CVPR 2018)

StarGAN: Unified Generative Adversarial Networks for Multi-Domain Image-to-Image Translation

Yunjey Choi 5.1k Dec 30, 2022
This is RFA-Toolbox, a simple and easy-to-use library that allows you to optimize your neural network architectures using receptive field analysis (RFA) and create graph visualizations of your architecture.

ReceptiveFieldAnalysisToolbox This is RFA-Toolbox, a simple and easy-to-use library that allows you to optimize your neural network architectures usin

84 Nov 23, 2022
Recommendation algorithms for large graphs

Fast recommendation algorithms for large graphs based on link analysis. License: Apache Software License Author: Emmanouil (Manios) Krasanakis Depende

Multimedia Knowledge and Social Analytics Lab 27 Jan 07, 2023
A python/pytorch utility library

A python/pytorch utility library

Jiaqi Gu 5 Dec 02, 2022
Graph Regularized Residual Subspace Clustering Network for hyperspectral image clustering

Graph Regularized Residual Subspace Clustering Network for hyperspectral image clustering

Yaoming Cai 5 Jul 18, 2022
This is the official implementation of 3D-CVF: Generating Joint Camera and LiDAR Features Using Cross-View Spatial Feature Fusion for 3D Object Detection, built on SECOND.

3D-CVF This is the official implementation of 3D-CVF: Generating Joint Camera and LiDAR Features Using Cross-View Spatial Feature Fusion for 3D Object

YecheolKim 97 Dec 20, 2022
Pytorch Implementation for CVPR2018 Paper: Learning to Compare: Relation Network for Few-Shot Learning

LearningToCompare Pytorch Implementation for Paper: Learning to Compare: Relation Network for Few-Shot Learning Howto download mini-imagenet and make

Jackie Loong 246 Dec 19, 2022
Code for the paper "Reinforcement Learning as One Big Sequence Modeling Problem"

Trajectory Transformer Code release for Reinforcement Learning as One Big Sequence Modeling Problem. Installation All python dependencies are in envir

Michael Janner 269 Jan 05, 2023