# [work]Swap tensor axes in tensorflow

I have a tensor of shape (30,116,10) and I want to swap the first two dimesions, so that I have a tensor of shape (116,30,10)

I saw that numpy as such a function implemented (np.swapaxes) and I searched for something similar in tensorflow but I found nothing.

Do you have any idea ?

Alexis

tf.transpose provides the same functionality as np.swapaxes, although in a more generalized form. In your case, you can do tf.transpose(orig_tensor, [1, 0, 2]) which would be equivalent to np.swapaxes(orig_np_array, 0, 1).

#### TensorFlow - Tensor理解与使用

2017-05-30 11:33:33

#### [Tensorflow]tensor 数学运算和逻辑运算

2017-11-09 14:59:45

#### TensorFlow打印tensor值

2017-07-13 12:01:14

#### Tensorflow 获取Tensor的维度

2018-03-14 12:58:16

#### Tensorflow 学习笔记- tensor的声明

2017-09-19 21:22:58

#### tensorflow: 如何定义常量tensor与变量tensor

2017-09-22 13:57:20

#### tensorflow: 获取tensor维度

2018-05-22 16:12:43

#### Tensorflow之class Tensor

2017-09-11 21:25:31

#### TensorFlow之Tensor维度理解

2018-05-27 19:18:38