tensorflow第一个例子
tensorflow吧
全部回复
仅看楼主
level 1
yuejing008 楼主
import tensorflow as tf
# 创建一个常量 op, 产生一个 1x2 矩阵. 这个 op 被作为一个节点
# 加到默认图中.
## 构造器的返回值代表该常量 op 的返回值.
matrix1 = tf.constant([[3., 3.]])
# 创建另外一个常量 op, 产生一个 2x1 矩阵.
matrix2 = tf.constant([[2.],[2.]])
# 创建一个矩阵乘法 matmul op , 把 'matrix1' 和 'matrix2' 作为输入.
# 返回值 'product' 代表矩阵乘法的结果.
product = tf.matmul(matrix1, matrix2)
对python不是很熟,这里写列表时,怎么使用[3., 3.]这样的写法
2019年03月18日 12点03分 1
level 1
yuejing008 楼主
就python的教程,列表是这样子的
[1, 2, 3, 4] 后面并没有跟什么符号, 包含"."
其他语言也没有这样的写法
2019年03月18日 12点03分 2
level 1
yuejing008 楼主
只有广告?
2019年03月18日 14点03分 3
level 3
没懂你的问题,.在这里代表的是浮点类型,不写的话默认是整形
2019年03月20日 05点03分 4
真是浮点数, 一直以为浮点数是这样写法2.0, 3.0, python里可以简写成2. 3.
2019年03月20日 07点03分
1