官术网_书友最值得收藏!

Matrix transpose

Transposition of the matrix is the mirror image of the matrix across the main diagonal. A symmetric matrix is any matrix that is equal to its own transpose:

The following example shows how to use a transpose operator on tensor objects:

import tensorflow as tf

x = [[1,2,3],[4,5,6]]
x = tf.convert_to_tensor(x)
xtrans = tf.transpose(x)

y=([[[1,2,3],[6,5,4]],[[4,5,6],[3,6,3]]])
y = tf.convert_to_tensor(y)
ytrans = tf.transpose(y, perm=[0, 2, 1])

with tf.Session() as sess:
print(sess.run(xtrans))
print(sess.run(ytrans))

The output of the listing is shown as follows:

[[1 4] [2 5] [3 6]]
主站蜘蛛池模板: 桂阳县| 望城县| 蒲江县| 太仆寺旗| 南宁市| 古丈县| 稻城县| 泌阳县| 新建县| 龙海市| 拜泉县| 北辰区| 德保县| 黄冈市| 西乌珠穆沁旗| 太原市| 乌鲁木齐县| 夏邑县| 崇信县| 襄城县| 郎溪县| 乐至县| 泾源县| 广灵县| 武川县| 嘉祥县| 甘泉县| 嘉义市| 斗六市| 社会| 宝应县| 贵定县| 张家界市| 商河县| 攀枝花市| 桓仁| 高淳县| 长岭县| 闻喜县| 湘西| 福海县|