Skip to content

Instantly share code, notes, and snippets.

@alinazhanguwo
Created March 22, 2019 21:04
Show Gist options
  • Save alinazhanguwo/b6d147339757a43510ed2a605720edba to your computer and use it in GitHub Desktop.
Save alinazhanguwo/b6d147339757a43510ed2a605720edba to your computer and use it in GitHub Desktop.
# Create an interactive Tensorflow session
sess = tf.InteractiveSession()
# These will be inputs for the model
# Input pixels of images, flattened
# 1296 = 36*36 which is the size of images
x = tf.placeholder("float", [None, 1296])
# Known labels
y_ = tf.placeholder("float", [None,2])
# Variables
# W is for weights
# b is for bias
# these 2 variables will be updated during the training
W = tf.Variable(tf.zeros([1296,2]))
b = tf.Variable(tf.zeros([2]))
# Initialize variables
sess.run(tf.global_variables_initializer())
# Define our logistic regression model
y = tf.nn.softmax(tf.matmul(x,W) + b)
# Finish model specification, let us start training the model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment