tf.constant学习
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学习相关推荐
- tensorflow1.11.0 tf.constant()函数(创建一个常数张量)
tf.constant tf.constant(value,dtype=None,shape=None,name='Const',verify_shape=False ) Defined in ten ...
- 【TensorFlow】TensorFlow函数精讲之tf.constant()
tf.constant()可以实现生成一个常量数值. tf.constant()格式为: tf.constant(value,dtype,shape,name) 参数说明: value:常量值 dty ...
- TensorFlow基础篇(五)——tf.constant()
tf.constant()可以实现生成一个常量数值. tf.constant()格式为: tf.constant(value,dtype,shape,name) 参数说明: value:常量值 dty ...
- Tensorlow 中文API:tf.zeros() tf.ones()tf.fill()tf.constant()
在程序中有一处不理解的地方 import basic.util.prints这个basic包找不到也搜不到,有知道的帮忙留言,谢谢 可以在下面使用print(data.eval())来输出结果 Ten ...
- tf.constant(常量)
一.概述 格式:tf.constant(value, dtype=None, shape=None, name='Const', verify_shape=Fa ...
- tf.constant
参考 tf.train.piecewise_constant - 云+社区 - 腾讯云 tf.constant(value,dtype=None,shape=None,name='Const',v ...
- tf.constant用法
函数原型 tf.constant(value,dtype=None,shape=None,name='Const',verify_shape=False ) 第一个值是必须的,可以是一个数值,也可以是 ...
- tensorflow tf.constant使用
tensorflow中tf.constant()用于创建常量,函数原型为: tf.constant( value, dtype=None, shape=None, name='Const', veri ...
- 深入浅出TensorFlow2函数——tf.constant
分类目录:<深入浅出TensorFlow2函数>总目录 相关文章: · 深入浅出TensorFlow2函数--tf.constant · 深入浅出TensorFlow2函数--tf.Ten ...
最新文章
- 设置显示Git的修改历史History快捷键Alt+H,方便多人开发的时候快速查看谁修改了代码
- 初创企业购买企业邮箱_支持#NetNeutrality =支持设计师及其创建的初创企业
- delete表1条件是另一个表中的数据,多表连接删除(转)
- 脚本升级_手把手教你升级到Database 19c(3)| 终章教程
- sql数据库连接不上本地数据库的解决办法
- python都可以开发什么_Python的优势到底是什么?Python都能开发什么?
- [NOIP2017]图书管理员
- Opencv2与Opencv4共存
- 后缀树 c++代码实现
- TI FMCW毫米波雷达基础(2)——测速原理
- android 使用iphone线控耳机,耳机 篇一:关于安卓手机怎么用苹果专用耳机的问题...
- Berkeley DB(BDB)
- 事务的隔离级别(附Redis的简述)
- 国外免费php mysql空间_超大20G国外免费php空间 支持PHP,MYSQL数据库
- 七问七答 买到假戴森吹风机我该怎么办?
- mac桌面文件夹突然消失解决办法
- 电子科技大学随机过程和电子科技大学矩阵理论矩阵理论总结
- C语言:L1-068 调和平均 (10 分)
- 微信dat文件用什么软件打开方式_dat文件怎么打开(微信dat文件用什么软件打开)...
- cisco认证学习总结