分类目录:《深入浅出TensorFlow2函数》总目录
相关文章:
· 深入浅出TensorFlow2函数——tf.Tensor
· 深入浅出Pytorch函数——torch.Tensor
· 深入浅出PaddlePaddle函数——paddle.Tensor
一个tf.Tensor
表示一个多维数组。在编写TensorFlow程序时,被操作和传递的主要对象就是tf.Tensor
。文章来源:https://www.toymoban.com/news/detail-580659.html
tf.Tensor(op, value_index, dtype)
tf.Tensor
具有以下属性:文章来源地址https://www.toymoban.com/news/detail-580659.html
- 数据类型(如:
float32
,int32
,string
) - 形状
属性
-
device
:产生该张量的设备的名称 -
dtype
:张量元素的类型 -
graph
:包含这个张量的Graph
-
name
:张量的名称 -
op
:张量的Operation
-
shape
:张量的形状,等同于tf.Tensor.get_shape()
-
value_index
:张量Operation
中的索引
方法
-
consumers()
:返回使用了这个张量的操作列表 -
eval(feed_dict=None, session=None)
:在Session
中计算该张量 -
get_shape()
:返回表示该张量形状的tf.TensorShape
-
ref()
:返回该张量的哈希引用对象 -
set_shape(shape)
:设置该张量的形状,但更建议使用tf.ensure_shape(x, shape, name=None)
到了这里,关于深入浅出TensorFlow2函数——tf.Tensor的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!