tensorflow Shapes and Shaping
来源:互联网 发布:java创建线程runnable 编辑:程序博客网 时间:2024/05/19 22:55
tf.shape(input, name=None)
mb = tf.constant([[1,2,3],[4,5,6]])shape = tf.shape(mb)sess.run(shape)
输出是:array([2, 3], dtype=int32)
tf.size(input, name=None)
Returns the size of a tensor.
mb = tf.constant([[1,2,3],[4,5,6]])shape = tf.shape(mb)shape = tf.size(mb)
输出是:6
tf.rank(input, name=None)
Returns the rank of a tensor.
注解:其中这个rank(阶),可以理解为数组的维度(几维数据)
mb = tf.constant([[1,2,3],[4,5,6]])sess.run(tf.rank(mb)
tf.reshape(tensor, shape, name=None
Reshapes a tensor
mb = tf.constant([[1,2,3],[4,5,6]])sess.run(tf.reshape(mb, [3,2]))输出是:
array([[1, 2],
[3, 4],
[5, 6]], dtype=int32)
tf.squeeze(input, squeeze_dims=None, name=None)
Removes dimensions of size 1 from the shape of a tensor.
arr = tf.Variable(tf.truncated_normal([3,4,1,6,1], stddev=0.1))arr2 = tf.squeeze(arr)输出是:
array([3, 4, 6], dtype=int32
tf.expand_dims(input, dim, name=None)
Inserts a dimension of 1 into a tensor's shape.
注释:在tensor中增加维度,其中dim表示增加的位置
ma = tf.constant([1.1, 1.2])tf.expand_dims(ma, 1)sess.run(mc)输出是:
array([[ 1.10000002],
[ 1.20000005]], dtype=float32)
阅读全文
0 0
- tensorflow Shapes and Shaping
- tensorflow: Shapes and Shaping 探究
- Notes on tensorflow(五)Tensor Ranks, Shapes, and Types
- custom textures and Shapes
- Coordinate System and Shapes
- Use the Shapes window to organize and find shapes
- Shapes and line types for R
- Tensorflow error : Assign requires shapes of both tensors to match
- WPF FlowDocuments (1) – Images, Shapes and Tables
- 第六章 Vector Shapes and Text in 3D
- The Cairo graphics tutorial -------Shapes and fills in Cairo
- iOS Paths and Shapes (路径和形状)路径裁剪
- Shaping Regions
- [[Journey to the Center of the Linux Kernel: Traffic Control, Shaping and QoS]]
- Tensorflow download and setup
- Install tensorflow and test
- Threading and Queues -- Tensorflow
- Tensorflow Graphs and Sessions
- 【设计模式】——装饰者模式
- centos设置服务自动重启
- Netty版本升级血泪史之线程篇
- 2017 四川省赛 L Nice Trick 思维+dp
- Sublime Text 全程指引 by Lucida
- tensorflow Shapes and Shaping
- C# 装箱与拆箱
- Android Studio 使用技巧:修改默认build.gradle
- SPP(Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition)
- Reverse String II
- Scala => 用法总结
- Unity Shader入门精要笔记(十三):法线纹理
- 【转载】excel中自带的条件格式设置
- python3中无法导入cPickle