Difference between revisions of "TensorFlow: Test Graph untuk berhitung"

From OnnoWiki
Jump to navigation Jump to search
(Created page with "Ketik python Ketik import tensorflow as tf x = tf.constant(8) y = tf.constant(9) z = tf.multiply(x, y) sess = tf.Session() out_z = sess.run(z) Finally, close the Te...")
 
 
(6 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
  sess = tf.Session()
 
  sess = tf.Session()
 
  out_z = sess.run(z)
 
  out_z = sess.run(z)
Finally, close the TensorFlow session when you're done:
+
  sess.close()
  sess.close()print('The multiplicaiton of x and y: %d' % out_z)
+
print('The multiplicaiton of x and y: %d' % out_z)
 +
quit()
  
  
 +
Atau ketik
 +
 +
import tensorflow as tf
 +
with tf.Session() as sess:
 +
    x = tf.placeholder(tf.float32, name="x")
 +
    y = tf.placeholder(tf.float32, name="y")
 +
    z = tf.multiply(x,y)
 +
    z_output = sess.run(z,feed_dict={x:8,y:9})
 +
sess.close()
 +
print(z_output)
  
  
 
==Pranala Menarik==
 
==Pranala Menarik==
 +
 +
 +
* [[TensorFlow]]

Latest revision as of 18:52, 29 July 2019

Ketik

python

Ketik

import tensorflow as tf
x = tf.constant(8)
y = tf.constant(9)
z = tf.multiply(x, y)
sess = tf.Session()
out_z = sess.run(z)
sess.close()
print('The multiplicaiton of x and y: %d' % out_z)
quit()


Atau ketik

import tensorflow as tf
with tf.Session() as sess:
   x = tf.placeholder(tf.float32, name="x")
   y = tf.placeholder(tf.float32, name="y")
   z = tf.multiply(x,y)
   z_output = sess.run(z,feed_dict={x:8,y:9})
sess.close()
print(z_output)


Pranala Menarik