Jambang067 commited on
Commit
c313beb
1 Parent(s): e11da6a

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +37 -0
main.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tensorflow as tf
2
+
3
+ # Create a Constant op that produces a 1x2 matrix. The op is
4
+ # added as a node to the default graph.
5
+ #
6
+ # The value returned by the constructor represents the output
7
+ # of the Constant op.
8
+ matrix1 = tf.constant([[3., 3.]])
9
+
10
+ # Create another Constant that produces a 2x1 matrix.
11
+ matrix2 = tf.constant([[2.],[2.]])
12
+
13
+ # Create a Matmul op that takes 'matrix1' and 'matrix2' as inputs.
14
+ # The returned value, 'product', represents the result of the matrix
15
+ # multiplication.
16
+ product = tf.matmul(matrix1, matrix2)
17
+
18
+ # Launch the default graph.
19
+ sess = tf.Session()
20
+
21
+ # To run the matmul op we call the session 'run()' method, passing 'product'
22
+ # which represents the output of the matmul op. This indicates to the call
23
+ # that we want to get the output of the matmul op back.
24
+ #
25
+ # All inputs needed by the op are run automatically by the session. They
26
+ # typically are run in parallel.
27
+ #
28
+ # The call 'run(product)' thus causes the execution of threes ops in the
29
+ # graph: the two constants and matmul.
30
+ #
31
+ # The output of the op is returned in 'result' as a numpy `ndarray` object.
32
+ result = sess.run(product)
33
+ print(result)
34
+ # ==> [[ 12.]]
35
+
36
+ # Close the Session when we're done.
37
+ sess.close()