tensorflow官方文档有误 关于transpose
来源:互联网 发布:网络机顶盒占用网速 编辑:程序博客网 时间:2024/05/22 04:55
tf.transpose(a, perm=None, name='transpose')
Transposes a
. Permutes the dimensions according to perm
.
The returned tensor's dimension i will correspond to the input dimensionperm[i]
. Ifperm
is not given, it is set to (n-1...0), where n isthe rank of the input tensor. Hence by default, this operation performs aregular matrix transpose on 2-D input Tensors.
For example:
# 'x' is [[1 2 3]# [4 5 6]]tf.transpose(x) ==> [[1 4] [2 5] [3 6]]# Equivalentlytf.transpose(x perm=[0, 1]) ==> [[1 4] [2 5] [3 6]]应该是:
tf.transpose(x perm=[1,0]) ==> [[1 4] [2 5] [3 6]]
# 'perm' is more useful for n-dimensional tensors, for n > 2# 'x' is [[[1 2 3]# [4 5 6]]# [[7 8 9]# [10 11 12]]]# Take the transpose of the matrices in dimension-0tf.transpose(b, perm=[0, 2, 1]) ==> [[[1 4] [2 5] [3 6]] [[7 10] [8 11] [9 12]]]
Args:
a
: ATensor
.perm
: A permutation of the dimensions ofa
.name
: A name for the operation (optional).
Returns:
A transposed Tensor
.
我的测试代码:
import tensorflow as tf
x = tf.constant([[1, 2 ,3],[4, 5, 6]])
b=tf.transpose(x)
# Equivalently
c=tf.transpose(x ,[1,0])
# 'perm' is more useful for n-dimensional tensors, for n > 2
# 'x' is [[[1 2 3]
# [4 5 6]]
# [[7 8 9]
# [10 11 12]]]
# Take the transpose of the matrices in dimension-0
#tf.transpose(b, perm=[0, 2, 1])
with tf.Session() as sess:
print (sess.run(x))
print (sess.run(b))
print (sess.run(c))
效果:
[[1 2 3]
[4 5 6]]
[[1 4]
[2 5]
[3 6]]
[[1 4]
[2 5]
[3 6]]
- tensorflow官方文档有误 关于transpose
- Tensorflow 官方文档 Feed章节有误
- TensorFlow 官方文档中文版
- TensorFlow 官方文档中文版
- TensorFlow 官方文档中文版
- TensorFlow 官方文档中文版
- TensorFlow 官方文档中文版
- tensorflow官方文档中文版
- TensorFlow 官方文档中文版
- xcode4发布测试-打包(Archive),官方文档有误
- xcode4发布测试-打包(Archive),官方文档有误
- xcode4发布测试-打包(Archive),官方文档有误
- tensorflow tf.transpose()
- TENSORFLOW官方文档-MNIST小结
- Tensorflow官方中文文档(HR)
- TensorFlow官方中文文档-读书笔记
- 《TensorFlow官方文档》快速入门
- 《TensorFlow官方文档》入门指南
- 耳机插头的一些问题
- AVPlayer 对M3u8视频 进行截屏
- Linux下配置Jenkins+Android自动化构建环境(二)
- ScheduledExecutorService执行周期性或定时任务
- Android网络编程(三)Volley用法全解析
- tensorflow官方文档有误 关于transpose
- 日语变形总结
- 自己开发的网页在跳转至微信公众号文章后,点击微信的返回,无法返回原网页
- 关于Http中Transfer-Encoding: chunked问题
- git基础使用命令
- Linux查看端口占用, lsof -i:port
- 日语动词变形(概念明确篇)
- C++ Primer 第5版--练习6.47
- ${pageContext.request.contextPath}路径使用