some TensorFlow and DeepLearning(NN) ..
Neural Network:
- a single neuron - input -> [neuron] -> output
- now we have multiple inputs -
1. Declaring Constants.
x1 = tf.constant([1,2,3,4])
x1 = tf.constant([2,3,4,5])
now once you have defined constants you want to do some operations on them.
result = tf.multiply(x1, x2)
you can also do simply result = x1*x2, but the above one is the way to do it. now you want to print the result we get the output.
<tf.Tensor 'Mul:0' shape=(4,) dtype=int32>,this is not we wanted this is just some Tensor object, but we want the result for that what we need to do is create a tensorflow session and run the above code in the session, in tensorflow everything is apart of graph kind of thing and to access anything you need to run that in a session.
sess = tf.Session()
op = sess.run(result)
print(op)
sess.close()
the above code can also be written as below
with tf.Session() as sess:
print(sess.run(result)
Yes
Neural Network:
- a single neuron - input -> [neuron] -> output
- now we have multiple inputs -
1. Declaring Constants.
x1 = tf.constant([1,2,3,4])
x1 = tf.constant([2,3,4,5])
now once you have defined constants you want to do some operations on them.
result = tf.multiply(x1, x2)
you can also do simply result = x1*x2, but the above one is the way to do it. now you want to print the result we get the output.
<tf.Tensor 'Mul:0' shape=(4,) dtype=int32>,this is not we wanted this is just some Tensor object, but we want the result for that what we need to do is create a tensorflow session and run the above code in the session, in tensorflow everything is apart of graph kind of thing and to access anything you need to run that in a session.
sess = tf.Session()
op = sess.run(result)
print(op)
sess.close()
the above code can also be written as below
with tf.Session() as sess:
print(sess.run(result)
Yes
Comments
Post a Comment