jj

from __future__ import print_function import tensorflow as tf # Import MNIST data from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) # Parameters learning_rate = 0.01 training_epochs = 25 batch_size = 100 display_step = 1 logs_path = '/tmp/tensorflow_logs/example' # Network Parameters n_hidden_1 = 256 # 1st layer number of features n_hidden_2 = 256 # 2nd layer number of features n_input = 784 # MNIST data input (img shape: 28*28) n_classes = 10 # MNIST total classes (0-9 digits) # tf Graph Input # mnist data image of shape 28*28=784 x = tf.placeholder(tf.float32, [None, 784], name='InputData') # ۰-۹ digits recognition => 10 classes y = tf.placeholder(tf.float32, [None, 10], name='LabelData') # Create model def multilayer_perceptron(x, weights, biases): # Hidden layer with RELU activation layer_1 = tf.add(tf.matmul(x, weights['w1']), biases['b1']) layer_1 = tf.nn.relu(layer_1) # Create a summary to visualize the first layer ReLU activation tf.histogram_summary("relu1", layer_1) # Hidden layer with RELU activation layer_2 = tf.add(tf.matmul(layer_1, weights['w2']), biases['b2']) layer_2 = tf.nn.relu(layer_2) # Create another summary to visualize the second layer ReLU activation tf.histogram_summary("relu2", layer_2) # Output layer out_layer = tf.add(tf.matmul(layer_2, weights['w3']), biases['b3']) return out_layer # Store layers weight & bias weights = { 'w1': tf.Variable(tf.random_normal([n_input, n_hidden_1]), name='W1'), 'w2': tf.Variable(tf.random_normal([n_hidden_1, n_hidden_2]), name='W2'), 'w3': tf.Variable(tf.random_normal([n_hidden_2, n_classes]), name='W3') } biases = { 'b1': tf.Variable(tf.random_normal([n_hidden_1]), name='b1'), 'b2': tf.Variable(tf.random_normal([n_hidden_2]), name='b2'), 'b3': tf.Variable(tf.random_nor

jj

from __future__ import print_function
import tensorflow as tf
# Import MNIST data
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
# Parameters
learning_rate = 0.01
training_epochs = 25
batch_size = 100
display_step = 1
logs_path = '/tmp/tensorflow_logs/example'
# Network Parameters
n_hidden_1 = 256 # 1st layer number of features
n_hidden_2 = 256 # 2nd layer number of features
n_input = 784 # MNIST data input (img shape: 28*28)
n_classes = 10 # MNIST total classes (0-9 digits)
# tf Graph Input
# mnist data image of shape 28*28=784
x = tf.placeholder(tf.float32, [None, 784], name='InputData')
# Û°-Û¹ digits recognition => 10 classes
y = tf.placeholder(tf.float32, [None, 10], name='LabelData')
# Create model
def multilayer_perceptron(x, weights, biases):
    # Hidden layer with RELU activation
    layer_1 = tf.add(tf.matmul(x, weights['w1']), biases['b1'])
    layer_1 = tf.nn.relu(layer_1)
    # Create a summary to visualize the first layer ReLU activation
    tf.histogram_summary("relu1", layer_1)
    # Hidden layer with RELU activation
    layer_2 = tf.add(tf.matmul(layer_1, weights['w2']), biases['b2'])
    layer_2 = tf.nn.relu(layer_2)
    # Create another summary to visualize the second layer ReLU activation
    tf.histogram_summary("relu2", layer_2)
    # Output layer
    out_layer = tf.add(tf.matmul(layer_2, weights['w3']), biases['b3'])
    return out_layer
# Store layers weight & bias
weights = {
    'w1': tf.Variable(tf.random_normal([n_input, n_hidden_1]), name='W1'),
    'w2': tf.Variable(tf.random_normal([n_hidden_1, n_hidden_2]), name='W2'),
    'w3': tf.Variable(tf.random_normal([n_hidden_2, n_classes]), name='W3')
}
biases = {
    'b1': tf.Variable(tf.random_normal([n_hidden_1]), name='b1'),
    'b2': tf.Variable(tf.random_normal([n_hidden_2]), name='b2'),
    'b3': tf.Variable(tf.random_nor

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

سیزده − 6 =