Skip to content
Open
100 changes: 100 additions & 0 deletions MNIST_data/mnist_train_small.csv

Large diffs are not rendered by default.

158 changes: 81 additions & 77 deletions tf-graph-01.ipynb
Original file line number Diff line number Diff line change
@@ -1,83 +1,87 @@
{
"metadata": {
"name": "",
"signature": "sha256:51eea96adec6ac449fa39c082cf2e1b459b5caca45224eda0070702df09cc3c5"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
"cells": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"import tensorflow as tf"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"g = tf.Graph()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"with g.as_default():\n",
" \n",
" x = tf.constant([8], name=\"x_const\")\n",
" y = tf.constant([5], name=\"y_const\")\n",
" sum1 = tf.add(x, y, name=\"x_y_sum\")\n",
" \n",
" z = tf.constant([7], name=\"z_const\")\n",
" sum2 = tf.add(z, sum1, name=\"x_y_z_sum\")\n",
"\n",
" with tf.Session() as sess:\n",
" print 'Sum1 = ', sum1.eval()\n",
" print 'Sum2 = ', sum2.eval()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Sum1 = "
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[13]\n",
"Sum2 = [20]\n"
]
}
],
"prompt_number": 3
},
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import tensorflow as tf"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"g = tf.Graph()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
"name": "stdout",
"output_type": "stream",
"text": [
"Sum1 = [13]\n",
"Sum2 = [20]\n"
]
}
],
"metadata": {}
"source": [
"with g.as_default():\n",
" \n",
" x = tf.constant([8], name=\"x_const\")\n",
" y = tf.constant([5], name=\"y_const\")\n",
" sum1 = tf.add(x, y, name=\"x_y_sum\")\n",
" \n",
" z = tf.constant([7], name=\"z_const\")\n",
" sum2 = tf.add(z, sum1, name=\"x_y_z_sum\")\n",
"\n",
" with tf.Session() as sess:\n",
" print('Sum1 = ', sum1.eval())\n",
" print('Sum2 = ', sum2.eval())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": []
}
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.5.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading