tf_conceptual_graph
Create tensorflow(1.x) conceptual graph. Conceputual graph is not aimed to reconstruct a neural network. The main purpose of this conceputual graph is for treating a neural network as a heterogeneous graph. Once we can treat neural networks as heterogeneous graphs, we can apply graph neural network methods for them to predict inference results from trained neural networks. From the view point, we can optimize neural network structures.
Installtion
$ pip install tfcg
Usage
read a graph_def object from object api(sess.graph_def)
import numpy as np
import tensorflow as tf
import tfcg
with tf.Graph().as_default() as graph:
model = tf.keras.Sequential()
x = np.random.rand(128, 28, 28, 3)
model.add(tf.keras.layers.Conv2D(16, 3, input_shape=[28, 28, 3], name='conv1'))
model.add(tf.keras.layers.Conv2D(32, 1, name='conv2'))
model.add(tf.keras.layers.Conv2D(64, 2, name='conv3'))
model.add(tf.keras.layers.Conv2D(128, 2, name='conv4'))
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(32, name='dense1'))
model.add(tf.keras.layers.ReLU())
model.add(tf.keras.layers.Dense(16, name='dense2'))
x_p = tf.placeholder(tf.float32, [None, 28, 28, 3], name='input')
out_p = model(x_p)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
o = sess.run(out_p, feed_dict={x_p: x})
_ = tf.identity(o, name="output")
tf.io.write_graph(sess.graph, './', 'train.pbtxt')
parser = tfcg.from_graph_def(sess.graph_def)
parser.dump_json("conceptual_graph.json")
parser.dump_img("output.png")
read a graph from a file, After dumpping a tensorflow graph file.
import tfcg
parser = tfcg.from_file("./train.pbtxt")
parser.dump_json("conceptual_graph.json")
mparser.dump_img("output.png")
Examples
Metadata
Release files for tfcg 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tfcg-0.1.4.tar.gz | 4.6 kB | Without provenance | Details for tfcg-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tfcg-0.1.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for tfcg-0.1.4-py2.py3-none-any.whl |
Total release size: 9.7 kB
Release files / tfcg-0.1.4.tar.gz
| Download URL | tfcg-0.1.4.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e477996074b3bc509651eb0d98a37b82846eca016887c4012fa71fb6242c3c3
|
|
BLAKE2b-256 checksum How to use checksums |
ac7d17ae7771d1b0b626bc7507794b7b9258d6c12330513e2edecffa0f808ebf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191203 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5
|
Release files / tfcg-0.1.4-py2.py3-none-any.whl
| Download URL | tfcg-0.1.4-py2.py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
00209ee871219c5fb4e9386fa8286e0fe1d07fb312a39cb7594183f3f8025528
|
|
BLAKE2b-256 checksum How to use checksums |
3b9cbeff8051b75e86ffe1474b2f5f5cd3ebd8fdaca9099f77ec1a01d4de798a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191203 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5
|
Security for tfcg 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.