- Neural Network Programming with TensorFlow
- Manpreet Singh Ghotra Rajdeep Dua
- 87字
- 2021-07-02 15:17:07
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]]
推薦閱讀
- Redis應(yīng)用實例
- 文本挖掘:基于R語言的整潔工具
- Starling Game Development Essentials
- 大數(shù)據(jù)精準(zhǔn)挖掘
- 淘寶、天貓電商數(shù)據(jù)分析與挖掘?qū)崙?zhàn)(第2版)
- 數(shù)據(jù)庫應(yīng)用系統(tǒng)開發(fā)實例
- Chef Essentials
- Spark分布式處理實戰(zhàn)
- Mastering LOB Development for Silverlight 5:A Case Study in Action
- 大數(shù)據(jù)數(shù)學(xué)基礎(chǔ)(Python語言描述)
- Access 2010數(shù)據(jù)庫程序設(shè)計實踐教程
- Access 2016數(shù)據(jù)庫應(yīng)用基礎(chǔ)
- 代碼的未來
- 實用預(yù)測分析
- 數(shù)據(jù)時代的品牌智造