tf.transpose
来源:互联网 发布:mysql 获取上一年月份 编辑:程序博客网 时间:2024/05/22 03:32
tf.transpose(X,perm = [2,0,1])就是对数组维数进行转换,X[i][j][k]=Y[k][i][j]import tensorflow as tfimport numpy as npinput_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] ]]print ("input_x shape:",np.shape(input_x))result = tf.transpose(input_x, perm=[2, 0, 1])with tf.Session() as sess: print("input_x",sess.run(result))input_y=np.zeros((4,2,3),dtype=int)for i in range(4): for j in range(2): for k in range(3): input_y[i][j][k]=input_x[j][k][i]print("input_y",input_y)
input_x shape: (2, 3, 4)input_x [[[ 1 5 9] [13 17 21]] [[ 2 6 10] [14 18 22]] [[ 3 7 11] [15 19 23]] [[ 4 8 12] [16 20 24]]]
input_y [[[ 1 5 9] [13 17 21]] [[ 2 6 10] [14 18 22]] [[ 3 7 11] [15 19 23]] [[ 4 8 12] [16 20 24]]]
阅读全文
0 0
- tf.transpose
- tf.transpose
- tf.transpose
- tf.transpose()函数
- tensorflow tf.transpose()
- pytorch的tf.transpose
- tf.transpose函数的用法
- tf.transpose (API r1.3)
- tf.transpose函数的用法讲解(多维情况,看似复杂,其实也简单)
- Matrix Transpose
- proc transpose
- Transpose File
- Transpose File
- python transpose
- np transpose
- numpy.transpose()
- Transpose File
- numpy.transpose()
- char s[] = "abcdef";"abcdef"是在栈区还是堆区?
- 小记:关于STM32进入低功耗模式后无法烧写程序的解决办法
- java处理时区的注意事项
- Linux Mysql 1130错误解决
- 在homestead下创建laravel/lumen项目
- tf.transpose
- js入门,和程序基础
- vue.js中报错: TypeError: Cannot read property 'indexOf' of undefined
- https://wenku.baidu.com/view/1f9138e903d8ce2f01662306.html
- c/c++失配指针
- map
- 浮点型的存储方式
- 修改eclipse字体大小
- AndroidStudio工程中的build.gradle中的buildTypes、productFlavors的多构建、多渠道打包APK