TensorFlow入门例子(0)
来源:互联网 发布:自媒体 内容来源 知乎 编辑:程序博客网 时间:2024/06/05 21:15
Introduction
basic_operations
# Basic constant operationsfrom __future__ import print_functionimport tensorflow as tfa = tf.constant(2)b = tf.constant(3)with tf.Session() as sess: print("a=2, b=3") # a=2, b=3 print("Addition with constants: %i" % sess.run(a+b)) # Addition with constants: 5 print("Multiplication with constants: %i" % sess.run(a*b)) # Multiplication with constants: 6# Basic Operations with variable as graph inputa = tf.placeholder(tf.int16)b = tf.placeholder(tf.int16)add = tf.add(a, b)mul = tf.multiply(a, b)with tf.Session() as sess: print("Addition with variables: %i" % sess.run(add, feed_dict={a: 2, b: 3})) # Addition with variables: 5 print("Multiplication with variables: %i" % sess.run(mul, feed_dict={a: 2, b: 3})) # Multiplication with variables: 6# More in details:matrix1 = tf.constant([[3., 3.]])matrix2 = tf.constant([[2.],[2.]])product = tf.matmul(matrix1, matrix2)with tf.Session() as sess: result = sess.run(product) print(result) # [[ 12.]]
helloworld
import tensorflow as tfhello = tf.constant('Hello, TensorFlow!')sess = tf.Session()print sess.run(hello) # Hello, TensorFlow!
阅读全文
0 0
- TensorFlow入门例子(0)
- 【tensorflow】tensorflow入门小例子
- tensorflow 神经网络入门例子
- Tensorflow入门例子(1)
- tensorflow(0)-入门
- Tensorflow快速入门3–代码结构及模型例子
- tensorflow入门实践例子—MNIST手写数字识别
- tensorflow 入门小例子(mnist手写数字识别)
- 【TensorFlow】TensorFlow快速入门
- TensorFlow入门
- TensorFlow 入门
- TensorFlow入门
- TensorFlow入门
- TensorFlow入门
- Tensorflow 入门
- TensorFlow 入门
- tensorflow入门
- TensorFlow 入门
- 让专业变成兴趣之Linux系统运维
- 函数指针与函数指针数组
- Mybatis异常收集
- EXT4文件系统之ext4_fill_super()
- 光照与渲染(一)- 简介
- TensorFlow入门例子(0)
- 光照与渲染(二)- 光照技术
- C++手动扩展
- 光照与渲染(三)- 预先计算的过程
- 光照与渲染(四)- 渲染路径
- 光照与渲染(五)- 色彩空间
- 光照与渲染(六)- 高动态范围(HDR)
- 数据库的连接形式
- 光照与渲染(七)- 反射