Title: I am very eager to your reply · Issue #2 · YJango/tensorflow_basic_tutorial · GitHub
Open Graph Title: I am very eager to your reply · Issue #2 · YJango/tensorflow_basic_tutorial
X Title: I am very eager to your reply · Issue #2 · YJango/tensorflow_basic_tutorial
Description: from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf def weight_varible(shape): initial =tf.truncated_normal(shape,stddev=0.1) return tf.Variable(initial) def bias_variable(shape): initial=tf.constant(0.1,sh...
Open Graph Description: from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf def weight_varible(shape): initial =tf.truncated_normal(shape,stddev=0.1) return tf.Variable(initial) def bias_var...
X Description: from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf def weight_varible(shape): initial =tf.truncated_normal(shape,stddev=0.1) return tf.Variable(initial) def bias_var...
Opengraph URL: https://github.com/YJango/tensorflow_basic_tutorial/issues/2
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"I am very eager to your reply","articleBody":"from tensorflow.examples.tutorials.mnist import input_data\r\n\r\nimport tensorflow as tf\r\n\r\n\r\ndef weight_varible(shape):\r\n\tinitial =tf.truncated_normal(shape,stddev=0.1)\r\n\treturn tf.Variable(initial)\r\n\r\n\r\ndef bias_variable(shape):\r\n\tinitial=tf.constant(0.1,shape=shape)\r\n\treturn tf.Variable(initial)\r\n\r\ndef conv2d(x,W):\r\n\treturn tf.nn.conv2d(x,W,strides=[1,1,1,1],padding='SAME')\r\n\r\ndef max_pool_2x2(x):\r\n\treturn tf.nn.max_pool(x,ksize=[1,2,2,1],strides=[1,2,2,1],padding='SAME')\r\n\r\nmnist=input_data.read_data_sets('MNIST_data',one_hot=True)\r\nsess=tf.InteractiveSession()\r\n\r\n################ input,for 2 models i use the same input ################3\r\nx=tf.placeholder(tf.float32,[None,784])\r\nx_image=tf.reshape(x,[-1,28,28,1])\r\n\r\n######################### the first model ########################################\r\nW_conv1=weight_varible([5,5,1,32])\r\nb_conv1=weight_varible([32])\r\n\r\nh_conv1=tf.nn.relu(conv2d(x_image,W_conv1)+b_conv1)\r\nh_pool1=max_pool_2x2(h_conv1)\r\n\r\nW_conv2=weight_varible([5,5,32,64])\r\nb_conv2=weight_varible([64])\r\n\r\nh_conv2=tf.nn.relu(conv2d(h_pool1,W_conv2)+b_conv2)\r\nh_pool2=max_pool_2x2(h_conv2)\r\n\r\nW_fc1=weight_varible([7*7*64,1024])\r\nb_fc1=weight_varible([1024])\r\n\r\nh_pool2_flat=tf.reshape(h_pool2,[-1,7*7*64])\r\nh_fc1=tf.nn.relu(tf.matmul(h_pool2_flat,W_fc1)+b_fc1)\r\n\r\nkeep_prob=tf.placeholder(tf.float32)\r\nh_fc1_drop=tf.nn.dropout(h_fc1,keep_prob)\r\n\r\nW_fc2=weight_varible([1024,10])\r\nb_fc2=weight_varible([10])\r\n\r\ny_conv=tf.nn.softmax(tf.matmul(h_fc1_drop,W_fc2)+b_fc2)\r\ny_=tf.placeholder(tf.float32,[None,10])\r\n\r\ncross_entropy=tf.reduce_sum(y_*tf.log(y_conv))\r\ntrain_step=tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)\r\ncorrect_prediction=tf.equal(tf.argmax(y_conv,1),tf.argmax(y_,1))\r\naccuracy=tf.reduce_mean(tf.cast(correct_prediction,tf.float32))\r\nsess.run(tf.initialize_all_variables())\r\n\r\n################## the second parallel model,i use the same input as the first ###############################\r\n\r\nW2_conv1=weight_varible([5,5,1,32])\r\nb2_conv1=weight_varible([32])\r\n\r\n# x=tf.placeholder(tf.float32,[None,784])\r\n# x_image=tf.reshape(x,[-1,28,28,1])\r\n\r\nh2_conv1=tf.nn.relu(conv2d(x_image,W2_conv1)+b2_conv1)\r\nh2_pool1=max_pool_2x2(h2_conv1)\r\n\r\nW2_conv2=weight_varible([5,5,32,64])\r\nb2_conv2=weight_varible([64])\r\n\r\nh2_conv2=tf.nn.relu(conv2d(h2_pool1,W2_conv2)+b2_conv2)\r\nh2_pool2=max_pool_2x2(h2_conv2)\r\n\r\nW2_fc1=weight_varible([7*7*64,1024])\r\nb2_fc1=weight_varible([1024])\r\n\r\nh2_pool2_flat=tf.reshape(h2_pool2,[-1,7*7*64])\r\nh2_fc1=tf.nn.relu(tf.matmul(h2_pool2_flat,W2_fc1)+b2_fc1)\r\n\r\nkeep_prob=tf.placeholder(tf.float32)\r\nh2_fc1_drop=tf.nn.dropout(h2_fc1,keep_prob)\r\n\r\nW2_fc2=weight_varible([1024,10])\r\nb2_fc2=weight_varible([10])\r\n\r\ny2_=tf.placeholder(tf.float32,[None,10])\r\ny2_conv=tf.nn.softmax(tf.matmul(h2_fc1_drop,W2_fc2)+b2_fc2)\r\n\r\n\r\ncross_entropy=tf.reduce_sum(y2_*tf.log(y2_conv))\r\ntrain_step=tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)\r\ncorrect_prediction=tf.equal(tf.argmax(y2_conv,1),tf.argmax(y2_,1))\r\naccuracy=tf.reduce_mean(tf.cast(correct_prediction,tf.float32))\r\nsess.run(tf.initialize_all_variables())\r\n\r\n##########################################################\r\n\r\nfor i in range(20000):\r\n\tbatch=mnist.train.next_batch(50)\r\n\tif i%100==0:\r\n\t\ttrain_accuracy=accuracy.eval(feed_dict={x:batch[0],y_:batch[1],keep_prob:1})\r\n\t\tprint('step %d,train accuracy %g'%(i,train_accuracy))\r\n\ttrain_step.run([y_conv,y2_conv],feed_dict={x:batch[0],y_:batch[1],keep_prob:0.5})\r\nprint('test accuracy %g'%accuracy.eval(feed_dict={x:mnist.test.images,y_:mnist.test.labels,keep_prob:1.0}))","author":{"url":"https://github.com/FranNetty","@type":"Person","name":"FranNetty"},"datePublished":"2017-06-01T02:27:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2/tensorflow_basic_tutorial/issues/2"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f40c47db-46a1-82a6-c451-440189341bf5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E784:3F5DD2:5A4965:77FBF8:6A5804C5 |
| html-safe-nonce | b5d4ff841b29c2a4b4eb3465eb5cff7b896c786c4c4973ecb503b9fcc45e0ef8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzg0OjNGNUREMjo1QTQ5NjU6NzdGQkY4OjZBNTgwNEM1IiwidmlzaXRvcl9pZCI6IjQ1OTY4NDM4NjczNjcwMTU2MjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 012aa0afb892c588f7979efb8712655a4a1277af881b48380db86c3016c75e66 |
| hovercard-subject-tag | issue:232748597 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/YJango/tensorflow_basic_tutorial/2/issue_layout |
| twitter:image | https://opengraph.githubassets.com/50f117562e66621bfa323ca1bac32d085302c8c9554a8cc2a25fe9b6127c7f71/YJango/tensorflow_basic_tutorial/issues/2 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/50f117562e66621bfa323ca1bac32d085302c8c9554a8cc2a25fe9b6127c7f71/YJango/tensorflow_basic_tutorial/issues/2 |
| og:image:alt | from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf def weight_varible(shape): initial =tf.truncated_normal(shape,stddev=0.1) return tf.Variable(initial) def bias_var... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | FranNetty |
| hostname | github.com |
| expected-hostname | github.com |
| None | 49c8c15fabcbf356d607a90ca115c13b273e42ff8b74155de050fd229a9b0121 |
| turbo-cache-control | no-preview |
| go-import | github.com/YJango/tensorflow_basic_tutorial git https://github.com/YJango/tensorflow_basic_tutorial.git |
| octolytics-dimension-user_id | 16974308 |
| octolytics-dimension-user_login | YJango |
| octolytics-dimension-repository_id | 74321809 |
| octolytics-dimension-repository_nwo | YJango/tensorflow_basic_tutorial |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 74321809 |
| octolytics-dimension-repository_network_root_nwo | YJango/tensorflow_basic_tutorial |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3fb1f684e7a833eb1b2d01d39875a2b52cb4fe9b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width