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

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]]
主站蜘蛛池模板: 嘉义市| 黑龙江省| 安乡县| 胶州市| 泸水县| 长宁区| 榕江县| 历史| 威宁| 新巴尔虎左旗| 堆龙德庆县| 山阴县| 四平市| 抚宁县| 车致| 静海县| 榕江县| 咸阳市| 德兴市| 吴桥县| 鄱阳县| 营山县| 分宜县| 绥中县| 卫辉市| 克山县| 北碚区| 综艺| 泸西县| 府谷县| 上蔡县| 临沭县| 平顶山市| 平湖市| 始兴县| 阆中市| 霞浦县| 屏东县| 鹤岗市| 天津市| 阳新县|