tf.constant官方文档

https://www.tensorflow.org/api_docs/python/tf/constant
constant(value,dtype=None,shape=None,name='Const',verify_shape=False
)

tensor的shape

import tensorflow as tftensor=tf.constant([1,2,3,4,5,6,7,8,9])
print(tensor.shape)
print(tf.shape(tensor))
print(tensor.get_shape())
tensor=tf.constant([[1,2,3],[4,5,6],[7,8,9]])
print(tensor.shape)
print(tf.shape(tensor))
print(tensor.get_shape())
tensor=tf.constant([[[1,1,1],[2,2,3],[3,3,3]],[[4,4,4],[5,5,5],[6,6,6]]])
print(tensor.shape)
print(tf.shape(tensor))
print(tensor.get_shape())

输出结果

/usr/bin/python3.4 /home/ubuntu/PycharmProjects/pythonproject/tensorflowlearning/constantlearn.py
(9,)
Tensor("Shape:0", shape=(1,), dtype=int32)
(9,)
(3, 3)
Tensor("Shape_1:0", shape=(2,), dtype=int32)
(3, 3)
(2, 3, 3)
Tensor("Shape_2:0", shape=(3,), dtype=int32)
(2, 3, 3)Process finished with exit code 0

可以看出tensor.shape=tensor.get_shape()
而tf.shape(tensor)表示的是tensor的整体结构,tensor里面的shape表示tensor的阶也就是维度。
程序员有偿接单和程序指导加QQ:734564390

tf.constant学习相关推荐

  1. tensorflow1.11.0 tf.constant()函数(创建一个常数张量)

    tf.constant tf.constant(value,dtype=None,shape=None,name='Const',verify_shape=False ) Defined in ten ...

  2. 【TensorFlow】TensorFlow函数精讲之tf.constant()

    tf.constant()可以实现生成一个常量数值. tf.constant()格式为: tf.constant(value,dtype,shape,name) 参数说明: value:常量值 dty ...

  3. TensorFlow基础篇(五)——tf.constant()

    tf.constant()可以实现生成一个常量数值. tf.constant()格式为: tf.constant(value,dtype,shape,name) 参数说明: value:常量值 dty ...

  4. Tensorlow 中文API:tf.zeros() tf.ones()tf.fill()tf.constant()

    在程序中有一处不理解的地方 import basic.util.prints这个basic包找不到也搜不到,有知道的帮忙留言,谢谢 可以在下面使用print(data.eval())来输出结果 Ten ...

  5. tf.constant(常量)

    一.概述 格式:tf​.​constant​(​value​,​ dtype​=​None​,​ shape​=​None​,​ name​=​'Const'​,​ verify_shape​=​Fa ...

  6. tf.constant

    参考   tf.train.piecewise_constant - 云+社区 - 腾讯云 tf.constant(value,dtype=None,shape=None,name='Const',v ...

  7. tf.constant用法

    函数原型 tf.constant(value,dtype=None,shape=None,name='Const',verify_shape=False ) 第一个值是必须的,可以是一个数值,也可以是 ...

  8. tensorflow tf.constant使用

    tensorflow中tf.constant()用于创建常量,函数原型为: tf.constant( value, dtype=None, shape=None, name='Const', veri ...

  9. 深入浅出TensorFlow2函数——tf.constant

    分类目录:<深入浅出TensorFlow2函数>总目录 相关文章: · 深入浅出TensorFlow2函数--tf.constant · 深入浅出TensorFlow2函数--tf.Ten ...

最新文章

  1. 设置显示Git的修改历史History快捷键Alt+H,方便多人开发的时候快速查看谁修改了代码
  2. 初创企业购买企业邮箱_支持#NetNeutrality =支持设计师及其创建的初创企业
  3. delete表1条件是另一个表中的数据,多表连接删除(转)
  4. 脚本升级_手把手教你升级到Database 19c(3)| 终章教程
  5. sql数据库连接不上本地数据库的解决办法
  6. python都可以开发什么_Python的优势到底是什么?Python都能开发什么?
  7. [NOIP2017]图书管理员
  8. Opencv2与Opencv4共存
  9. 后缀树 c++代码实现
  10. TI FMCW毫米波雷达基础(2)——测速原理
  11. android 使用iphone线控耳机,耳机 篇一:关于安卓手机怎么用苹果专用耳机的问题...
  12. Berkeley DB(BDB)
  13. 事务的隔离级别(附Redis的简述)
  14. 国外免费php mysql空间_超大20G国外免费php空间 支持PHP,MYSQL数据库
  15. 七问七答 买到假戴森吹风机我该怎么办?
  16. mac桌面文件夹突然消失解决办法
  17. 电子科技大学随机过程和电子科技大学矩阵理论矩阵理论总结
  18. C语言:L1-068 调和平均 (10 分)
  19. 微信dat文件用什么软件打开方式_dat文件怎么打开(微信dat文件用什么软件打开)...
  20. cisco认证学习总结

热门文章

  1. 关于对比损失(contrasive loss)的理解(相似度越大越相似的情况):
  2. FCOS—分割思想做目标检测
  3. Red Hat Enterprise Linux 官方正式版镜像下载
  4. 数据库的视图,视图的更新,视图的可操作性
  5. ARMSYS6410开发板产品FAQ
  6. BCD码的作用和实现
  7. 【电子器件笔记3】电容参数和选型
  8. 缺陷轰炸和beta测试详解
  9. 用淘礼金助手做0元购物软件这3点必须要知道
  10. Python列表、元组、字典相关练习题记录——第三天