用户登录
用户注册

分享至

tensorflow matrix

  • 作者: 爱因斯坦诺维奇凯奇
  • 来源: 51数据库
  • 2020-09-30
import tensorflow as tf
# 创建一个常量op, 产生一个1x2矩阵,这个op被作为一个节点
# 加到默认视图中
# 构造器的返回值代表该常量op的返回值
matrix1 = tr.constant([[3., 3.]])

# 创建另一个常量op, 产生一个2x1的矩阵
matrix2 = tr.constant([[2.], [2.]])

# 创建一个矩阵乘法matmul op,把matrix1和matrix2作为输入:
product = tf.matmul(matrix1, matrix2)



  回答简直sb



  挖个坟吧,我也有过这个疑问,后来想通了
import tensorflow as tf
a = [[1, 2], [3, 4]]
print(a)
b = tf.constant(a, name="b")
print(b)
with tf.Session() as sess:
print(sess.run(b))
a是矩阵,b便是张量,输入内容时要用Session()
软件
前端设计
程序设计
Java相关