TensorFlow——多维矩阵的转置(transpose)

今天在深度学习第四课的神经风格转移遇到了一个折磨了我很久的东西,就是高纬度矩阵转置,不得不说,一旦维度升高,真的会让人懵逼,废话不多说,开始讲一下我对TensorFlow中transpose()函数的用法。

先看一下官方API:

tf.transpose
transpose(
    a,                          #  a是一个张量
    perm=None,                  # perm就是你对张量怎么转置的规则,即序列改变列表
    name='transpose'
)

Args:
a: A Tensor.
perm: A permutation of the dimensions of a.
name: A name for the operation (optional).
Returns:
A transposed Tensor.

Transposes a. Permutes the dimensions according to perm.

The returned tensor’s dimension i will correspond to the input dimension perm[i]. If perm is not given, it is set to (n-1…0), where n is the rank of the input tensor. Hence by defaul

评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值