GithubHelp home page GithubHelp logo

chainer-graphviewer's Introduction

Graph viewer on Jupyter Notebook for Chainer

Install

$ pip install git+https://github.com/disktnk/chainer-graphviewer
  • This tool is run on Jupyter Notebook
  • if view ONNX model, need $ pip install onnx
  • if view Chainer model, need $ pip install chainer
  • if only use show_graph, Tensorflow user for example, don't have to install ONNX or Chainer module

Example for Chainer

# Network definition
class Net(chainer.Chain):
    def __init__(self):
        pass
    # snip...

from graphviewer.notebook.show import show_graph
from graphviewer.parser.chainer_graph import get_graphdef_from_model

model = L.Classifier(Net())

x = chainer.Variable(numpy.random.rand(1, 1, 28, 28).astype(numpy.float32))
t = chainer.Variable(numpy.random.rand(1).astype(numpy.int32))
y = model(x, t)

gdef = get_graphdef_from_model(model, (x, t))
show_graph(gdef)

chainer-mnist-graph-rep-capture

Example for ONNX

show model.onnx

from graphviewer.notebook.show import show_graph
from graphviewer.parser.onnx_graph import get_graphdef_from_file

gdef = get_graphdef_from_file('model.onnx')
show_graph(gdef)

onnx-mnist-graph-rep-capture

ipynb Example

Prepare (for developer)

  1. copy *.proto, current version is v1.12.0, put graphviewer/proto/
  2. $sed -i -e 's|"tensorflow/core/framework|"graphviewer/proto|g' graphviewer/proto/*.proto
  3. protoc --python_out=./ ./graphviewer/proto/*.proto

chainer-graphviewer's People

Contributors

disktnk avatar

Watchers

Zhang JinXiong(张金雄) avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.