tensorflow学习笔记(九):tf.shape()与tensor.get_shape()
tensorflow
一个面向所有人的开源机器学习框架
项目地址:https://gitcode.com/gh_mirrors/te/tensorflow

·
两种方法都可以获得变量的shape
tf.shape(x)
其中x可以是tensor,也可不是tensor,返回是一个tensor.
shape=tf.placeholder(tf.float32, shape=[None, 227,227,3] )
我们经常会这样来feed
数据,如果在运行的时候想知道None
到底是多少,这时候,只能通过tf.shape(x)[0]
这种方式来获得.
tensorflow
一个面向所有人的开源机器学习框架
项目地址:https://gitcode.com/gh_mirrors/te/tensorflow
tensor.get_shape()
只有tensor有这个方法, 返回是一个tuple, 里面的值是python类型。
tensor.shape
等价于 tensor.get_shape()
推荐内容




一个面向所有人的开源机器学习框架
最近提交(Master分支:2 个月前 )
4f64a3d5
Instead, check for this case in `ResolveUsers` and `ResolveOperand`, by querying whether the `fused_expression_root` is part of the `HloFusionAdaptor`.
This prevents us from stepping into nested fusions.
PiperOrigin-RevId: 724311958
2 个月前
aa7e952e
Fix a bug in handling negative strides, and add a test case that exposes it.
We can have negative strides that are not just -1, e.g. with a combining
reshape.
PiperOrigin-RevId: 724293790
2 个月前
更多推荐
相关推荐
查看更多
tensorflow

一个面向所有人的开源机器学习框架
TensorFlow

Project containig related material for my TensorFlow articles
tensorflow

TensorFlow for R
热门开源项目
活动日历
查看更多
直播时间 2025-04-09 14:34:18

樱花限定季|G-Star校园行&华中师范大学专场
直播时间 2025-04-07 14:51:20

樱花限定季|G-Star校园行&华中农业大学专场
直播时间 2025-03-26 14:30:09

开源工业物联实战!
直播时间 2025-03-25 14:30:17

Heygem.ai数字人超4000颗星火燎原!
直播时间 2025-03-13 18:32:35

全栈自研企业级AI平台:Java核心技术×私有化部署实战
目录
所有评论(0)