diff --git a/GraphvizbasedVisualition.ipynb b/GraphvizbasedVisualition.ipynb new file mode 100644 index 0000000..979ae06 --- /dev/null +++ b/GraphvizbasedVisualition.ipynb @@ -0,0 +1,186 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "id": "27dedb17", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "round-table\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import graphviz # doctest: +NO_EXE\n", + "#dot = graphviz.Digraph(comment='The Round Table')\n", + "dot = graphviz.Digraph('round-table', comment='The Round Table') \n", + "dot #doctest: +ELLIPSIS" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "44a6c0c1", + "metadata": {}, + "outputs": [], + "source": [ + "dot.node('A', 'DFF') # doctest: +NO_EXE\n", + "dot.node('B', 'AND')\n", + "dot.node('L', 'NOT')\n", + "\n", + "dot.edges(['AB', 'BL'])\n", + "dot.edge('A', 'L', constraint='false')" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "64ff1f86", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "// The Round Table\n", + "digraph \"round-table\" {\n", + "\tA [label=DFF]\n", + "\tB [label=AND]\n", + "\tL [label=NOT]\n", + "\tA -> B\n", + "\tB -> L\n", + "\tA -> L [constraint=false]\n", + "}\n", + "\n" + ] + } + ], + "source": [ + "print(dot.source)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "eac01595", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "round-table\n", + "\n", + "\n", + "\n", + "A\n", + "\n", + "DFF\n", + "\n", + "\n", + "\n", + "B\n", + "\n", + "AND\n", + "\n", + "\n", + "\n", + "A->B\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "L\n", + "\n", + "NOT\n", + "\n", + "\n", + "\n", + "A->L\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "B->L\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dot" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b7d9505d", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/TensorflowbasedGraph.ipynb b/TensorflowbasedGraph.ipynb new file mode 100644 index 0000000..8d7c510 --- /dev/null +++ b/TensorflowbasedGraph.ipynb @@ -0,0 +1,110 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "119c1861", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "WARNING:tensorflow:From /Users/rmkchowdary/opt/anaconda3/lib/python3.9/site-packages/tensorflow/python/compat/v2_compat.py:107: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.\n", + "Instructions for updating:\n", + "non-resource variables are not supported in the long term\n" + ] + } + ], + "source": [ + "import tensorflow.compat.v1 as tf\n", + "tf.disable_v2_behavior()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "aa16b6fe", + "metadata": {}, + "outputs": [], + "source": [ + "a = tf.placeholder(tf.bool,name =\"a\")\n", + "b = tf.placeholder(tf.bool,name =\"b\")\n", + "y = tf.math.logical_and(a,b,name=\"AND\")\n", + "y= tf.math.logical_not(a,name=\"NOT\")\n", + "z= tf.math.logical_and(y,y,name=\"y\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "a9b4d555", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2022-03-23 18:26:51.940414: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA\n", + "To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n" + ] + } + ], + "source": [ + "\n", + "from tensorflow.python.summary.writer.writer import FileWriter\n", + "sess1 = tf.compat.v1.Session()\n", + "#writer=tf.summary.FileWriter('./my_graph',sess.graph)\n", + "writer = tf.summary.FileWriter(\"log_dir1/logic_and\", sess1.graph) " + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "5a22ca48", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "UsageError: Line magic function `%tensorboard` not found.\n" + ] + } + ], + "source": [ + "#run in terminal below command\n", + "#tensorboard --logdir=/log_dir1/logic_and" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b38b9e60", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}