课程视频:https://www.bilibili.com/video/av9156347/?from=search&seid=6905181275544516403#page=1
课表:http://web.stanford.edu/class/cs20si/syllabus.html
- 作者:香蕉与打火机
- 博客:http://bananalighter.com
命令演示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
Python 2.7.12 (default, Nov 20 2017, 18:23:56) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf >>> a = tf.add(2,3) >>> a <tf.Tensor 'Add:0' shape=() dtype=int32> >>> b = tf.add(3.0,5.0) >>> b <tf.Tensor 'Add_1:0' shape=() dtype=float32> >>> sess = tf.Session() 2018-01-03 14:24:40.035399: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA >>> print sess.run(a) 5 >>> sess.close() >>> sess = tf.Session() >>> print sess.run(b) 8.0 >>> sess.close() >>> x = 2 >>> y = 3 >>> op1 = tf.add(x,y) >>> op2 = tf.mul(x,y) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'mul' >>> op3 = tf.pow(op2,op1) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'op2' is not defined >>> op2 = tf.multiply(x,y) >>> op3 = tf.pow(op2,op1) >>> sess <tensorflow.python.client.session.Session object at 0x7f3e7c7a6410> >>> sess.run(op3) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 889, in run run_metadata_ptr) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1047, in _run raise RuntimeError('Attempted to use a closed Session.') RuntimeError: Attempted to use a closed Session. >>> sess = tf.Session() >>> sess.run(op3) 7776 >>> useless = =tf.multiply(x,op1) File "<stdin>", line 1 useless = =tf.multiply(x,op1) ^ SyntaxError: invalid syntax >>> useless = tf.multiply(x,op1) >>> sess.run([op3,useless]) [7776, 10] |
slides_01