转置是TensorFlow中提供的函数。此函数用于转置输入张量。语法:转置(input_tensor,perm,conjugate)参数:input_tensor:顾名思义,它是要转置的张量。类型:T
转置是TensorFlow中提供的函数。此函数用于转置输入张量。
语法:转置(input_tensor,perm,conjugate)
参数:input_tensor:顾名思义,它是要转置的张量。类型:Tensor
perm:此参数指定要根据其转置输入张量的置换。类型:矢量
共轭:如果输入张量是complex类型,则此参数设置为True。类型:Boolean
示例1:
filter_none
edit close
play_arrow
link brightness_4 code
import tensorflow as geek x=极客常数([[1,2,3,4],[5,6,7,8]])转置张量=极客转置(x)
符号右
筛选器无
输出:
[2,6],[4,8]])
示例2:使用perm参数:
当该参数通过时,张量将沿给定轴转置。简单地说,它定义了转置张量的输出形状。
filter_none
edit close
play_arrow
link brightness_4 code
将张量流导入为geek x=极客常数([[[1,2,3][4,5,6]],[[7,8,9],[10,11,12]],[[13,14,15],[16,17,18]],[[19,20,21],[22,23,24]]])转置张量=极客转置(x,perm=[0,2,1])
chevron_right
filter_none
输出:
[2,5],[3,6]],[[7,10],[9,12]],[[13,16],[15,18]],[[19,22],[20,23],[21,24]])
形状是(4,3,2),因为我们的烫发是[0,2,1]。下面是从perm到输入张量shape的映射。
0=>42=>3数组([[1 1j,4 4j],[3 3j,6 6j]])我的个人笔记箭头_drop _up保存推荐文章:ML | AutoEncoder with TensorFlow 2.0介绍TensorFlow Python | TensorFlow abs()方法使用TensorFlow Python进行线性回归| TensorFlownn.softplus软件使用TensorFlow的Softmax回归使用TensorFlow Python介绍Tensor | TensorFlow sin()方法ML | Logistic使用Tensorflow Python | Tensorflow cos()方法Python | Tensorflow log()方法Python | Tensorflow exp()方法Python | Tensorflow tan()方法Python | Tensorflow的回归新谭()巨蟒|张索流乙状结肠(
amritansh222000查看此作者的投稿文章
“如果你喜欢itcandy.cn并且愿意贡献,你也可以使用贡献.itcandy.cn或者把你的文章寄到投稿@itcandy.cn。请参阅itcandy.cn主页上的文章,并帮助其他开发者。
如果您发现任何不正确的地方,请单击下面的“改进文章”按钮来改进本文。
文章标记:Python Tensorflow thumb_up是第一个投票的人。要做的事还没有投票。请写信给我们投稿@itcandy.cn报告与上述内容有关的任何问题