tensorflow学习(tensorflow入门与基本使用)

tensorflow入门与基本使用

计算图(computation graphy)

计算图是由一个个节点和连接各个节点的边组成,因此要定义一个计算图,只需要定义好各个节点以及节点的输入输出(对应计算图的边)。节点代表各种操作,如加法、乘法、卷积运算等等,输入输出主要是各种数据(tensor)。

import tensorflow as tf

# Create a Constant op that produces a 1x2 matrix.  创建产生1x2矩阵的常量运算The op is
# added as a node to the default graph.
# 作为节点添加到默认图形中。
# The value returned by the constructor represents the output  构造函数返回的值表示输出
# of the Constant op.
matrix1 = tf.constant([[3., 3.]])

# Create another Constant that produces a 2x1 matrix.
matrix2 = tf.constant([[2.],[2.]])

# Create a Matmul op that takes 'matrix1' and 'matrix2' as inputs.
# The returned value, 'product', represents the result of the matrix
# multiplication.
product = tf.matmul(matrix1, matrix2)
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值