tensorflow identity

Return a tensor with the same shape and contents as the input tensor or value.
Args:
input: A Tensor.
name: A name for the operation (optional).
Returns:

A Tensor. Has the same type as input.


举例:

a = tf.random_uniform([2,3], minval = 10, maxval = 11)
sess.run(a)

输出:

array([[ 10.32342529,  10.05036354,  10.71219158],
       [ 10.92466164,  10.04347134,  10.30799294]], dtype=float32)


b = tf.identity(a)
sess.run(b)

输出:

array([[ 10.19113731,  10.08955765,  10.86665058],
       [ 10.10772514,  10.18272018,  10.47456551]], dtype=float32)


总结:两个输出是一样的,所以identity可以理解完成了tensor的复制,产生了一个同样形状和内容的tensor

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值