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

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]]
主站蜘蛛池模板: 海门市| 余姚市| 田东县| 绥芬河市| 洪江市| 永和县| 青河县| 稻城县| 大渡口区| 沐川县| 佛坪县| 从江县| 丰城市| 库伦旗| 张掖市| 许昌市| 武威市| 黄骅市| 雷山县| 家居| 沈阳市| 堆龙德庆县| 惠州市| 城固县| 临潭县| 大方县| 桓仁| 宁化县| 石首市| 合水县| 深泽县| 铁力市| 郯城县| 光山县| 万安县| 新乐市| 台东市| 林甸县| 新乐市| 秦安县| 乐业县|