Difference between revisions of "Tensorflow Guide"

From Storrs HPC Wiki
Jump to: navigation, search
(Check Version)
(Example)
Line 45: Line 45:
  
 
==Example==
 
==Example==
 
+
 
 +
$ python
 +
Python 2.7.6 (default, Apr 20 2016, 16:39:52)
 +
[GCC 4.8.2] on linux2
 +
Type "help", "copyright", "credits" or "license" for more information.
 +
>>> import tensorflow as tf
 +
>>> node1 = tf.constant(3.0, tf.float32)
 +
>>> node2 = tf.constant(4.0)
 +
>>> node3 = tf.add(node1, node2)
 +
>>> sess = tf.Session()
 +
>>> sess.run(node3)
 +
7.0
 +
>>> a = tf.placeholder(tf.float32)
 +
>>> b = tf.placeholder(tf.float32)
 +
>>> adder_node = a + b
 +
>>> print(sess.run(adder_node, {a: 3, b:4.5}))
 +
7.5
 +
>>> print(sess.run(adder_node, {a: [1,3], b: [2, 4]}))
 +
[ 3.  7.]
 +
>>> add_and_triple = adder_node * 3
 +
>>> print(sess.run(add_and_triple, {a: 3, b:4.5}))
 +
22.5
 +
>>> 
 
   
 
   
 
<nowiki>[[Category:Software]]</nowiki>
 
<nowiki>[[Category:Software]]</nowiki>

Revision as of 13:34, 10 April 2017

Tensorflow
Author Google Brain Team
Website https://www.tensorflow.org/
Source HistoryVersions
Category Machine Learning, Deep Neural Networks
Help documentation


Current Supported Versions in HPC

Supported CPU Version Corresponding Python Module Released Date
v0.10.0rc0 python/2.7.6 Jul 29, 2016
v0.12.1 python/2.7.6-gcc-unicode Dec 25, 2016
Supported GPU Version Corresponding Python Module Released Date
- - -

Import Modules

TensorFlow v0.10.0rc0

module load python/2.7.6

TensorFlow v0.12.1

 module load python/2.7.6-gcc-unicode

Application Usage

Check Version Number

 $ python
 Python 2.7.6 (default, Apr 20 2016, 16:39:52) 
 [GCC 4.8.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import tensorflow as tf
 >>> print tf.__version__
 0.12.1
 >>>

Example

$ python
Python 2.7.6 (default, Apr 20 2016, 16:39:52) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> node1 = tf.constant(3.0, tf.float32)
>>> node2 = tf.constant(4.0)
>>> node3 = tf.add(node1, node2)
>>> sess = tf.Session()
>>> sess.run(node3)
7.0
>>> a = tf.placeholder(tf.float32)
>>> b = tf.placeholder(tf.float32)
>>> adder_node = a + b
>>> print(sess.run(adder_node, {a: 3, b:4.5}))
7.5
>>> print(sess.run(adder_node, {a: [1,3], b: [2, 4]}))
[ 3.  7.]
>>> add_and_triple = adder_node * 3
>>> print(sess.run(add_and_triple, {a: 3, b:4.5}))
22.5
>>>  

<nowiki></nowiki>