深入浅出TensorFlow2函数——tf.Tensor

这篇具有很好参考价值的文章主要介绍了深入浅出TensorFlow2函数——tf.Tensor。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

分类目录:《深入浅出TensorFlow2函数》总目录
相关文章:
· 深入浅出TensorFlow2函数——tf.Tensor
· 深入浅出Pytorch函数——torch.Tensor
· 深入浅出PaddlePaddle函数——paddle.Tensor


一个tf.Tensor表示一个多维数组。在编写TensorFlow程序时,被操作和传递的主要对象就是tf.Tensor

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模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 深入浅出TensorFlow2函数——tf.Variable

    分类目录:《深入浅出TensorFlow2函数》总目录 语法 参数 initial_value :[ Tensor ] 变量的初始值。初始值必须具有指定的形状,除非 validate_shape 被设置为 False 。也可以是一个不带参数的可调用函数,调用时返回初始值。在这种情况下, dtype 必须指定。 trainable :[ bool ] 如果为

    2024年02月06日
    浏览(41)
  • 深入浅出TensorFlow2函数——tf.constant

    分类目录:《深入浅出TensorFlow2函数》总目录 相关文章: · 深入浅出TensorFlow2函数——tf.constant · 深入浅出TensorFlow2函数——tf.Tensor · 深入浅出Pytorch函数——torch.tensor · 深入浅出Pytorch函数——torch.as_tensor · 深入浅出PaddlePaddle函数——paddle.to_tensor 语法 参数 value :输出张量

    2024年02月11日
    浏览(29)
  • 深入浅出TensorFlow2函数——tf.random.poisson

    分类目录:《深入浅出TensorFlow2函数》总目录 绘制 shape 个来自每个给定泊松分布的样本。 语法 参数 shape :输出张量的形状,为一个一维整数张量或Python数组。 lam :样本提供描述泊松分布的参数。 dtype :输出的浮点类型: float16 、 bfloat16 、 float32 、 float64 ,默认为 float3

    2024年02月11日
    浏览(33)
  • 深入浅出TensorFlow2函数——tf.random.normal

    分类目录:《深入浅出TensorFlow2函数》总目录 语法 参数 shape :输出张量的形状,为一个一维整数张量或Python数组。 mean 正态分布的平均值。类型为张量或 dtype ,可与 stddev 一起广播。 stddev :正态分布的标准偏差。类型为张量或 dtype ,可与 mean 一起广播。 dtype :输出的浮点

    2024年02月12日
    浏览(24)
  • 深入浅出TensorFlow2函数——tf.math.exp

    分类目录:《深入浅出TensorFlow2函数》总目录 相关文章: · 深入浅出TensorFlow2函数——tf.exp · 深入浅出TensorFlow2函数——tf.math.exp · 深入浅出Pytorch函数——torch.exp · 深入浅出PaddlePaddle函数——paddle.exp 按元素计算 x x x 的指数 y = e x y=e^x y = e x 。 语法 参数 x :[ tf.Tensor ] 必须

    2024年02月12日
    浏览(24)
  • 深入浅出TensorFlow2函数——tf.random.uniform

    分类目录:《深入浅出TensorFlow2函数》总目录 绘制 shape 个来自每个给定均匀分布的样本。 语法 参数 shape :输出张量的形状,为一个一维整数张量或Python数组。 minval :要生成的随机值范围的下限(含),默认值为 0 。 minval :要生成的随机值范围的上限(不含),默认值为 1 。

    2024年02月11日
    浏览(25)
  • 深入浅出TensorFlow2函数——tf.reduce_sum

    分类目录:《深入浅出TensorFlow2函数》总目录 相关文章: · 深入浅出TensorFlow2函数——tf.reduce_sum · 深入浅出TensorFlow2函数——tf.math.reduce_sum · 深入浅出Pytorch函数——torch.sum · 深入浅出PaddlePaddle函数——paddle.sum 计算张量各维度上元素的总和。 语法 参数 input_tensor :[ Tensor

    2024年02月10日
    浏览(43)
  • 深入浅出TensorFlow2函数——tf.math.reduce_sum

    分类目录:《深入浅出TensorFlow2函数》总目录 相关文章: · 深入浅出TensorFlow2函数——tf.reduce_sum · 深入浅出TensorFlow2函数——tf.math.reduce_sum · 深入浅出Pytorch函数——torch.sum · 深入浅出PaddlePaddle函数——paddle.sum 计算张量各维度上元素的总和。 语法 参数 input_tensor :[ Tensor

    2024年02月12日
    浏览(22)
  • 深入浅出Pytorch函数——torch.tensor

    分类目录:《深入浅出Pytorch函数》总目录 相关文章: · 深入浅出TensorFlow2函数——tf.constant · 深入浅出Pytorch函数——torch.tensor · 深入浅出Pytorch函数——torch.as_tensor · 深入浅出Pytorch函数——torch.Tensor · 深入浅出PaddlePaddle函数——paddle.to_tensor 基于 data 构建一个没有梯度历史

    2024年02月04日
    浏览(85)
  • 深入浅出PaddlePaddle函数——paddle.Tensor

    分类目录:《深入浅出PaddlePaddle函数》总目录 相关文章: · 深入浅出TensorFlow2函数——tf.Tensor · 深入浅出Pytorch函数——torch.Tensor · 深入浅出PaddlePaddle函数——paddle.Tensor · 深入浅出PaddlePaddle函数——paddle.to_tensor Tensor 是Paddle中最为基础的数据结构,有几种创建 Tensor 的不同

    2024年02月04日
    浏览(30)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包