In [1]:
import tensorflow as tf
import numpy as np
In [2]:
node1 = tf.constant(3.0, tf.float32)
node2 = tf.constant(4.0)
print(node2, node2)
In [4]:
sess = tf.Session()
In [6]:
print(sess.run([node1, node2]))
In [7]:
node3 = tf.add(node1, node2)
In [15]:
print('node 3: ', node3, '\n', sess.run([node3]))
In [22]:
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
adder_node = tf.add(a,b)
sess.run(adder_node, {a:[3,2] ,b:[3,2]})
Out[22]:
In [23]:
weight = tf.Variable(.3, tf.float32)
bias = tf.Variable(-.5, tf.float32)
input = tf.placeholder(tf.float32)
In [24]:
linear_model = input * weight + bias
In [27]:
init = tf.global_variables_initializer()
In [ ]: