- 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]]
推薦閱讀
- Building Computer Vision Projects with OpenCV 4 and C++
- Visual Studio 2015 Cookbook(Second Edition)
- Voice Application Development for Android
- Hadoop與大數(shù)據(jù)挖掘(第2版)
- Python數(shù)據(jù)分析:基于Plotly的動態(tài)可視化繪圖
- Power BI商業(yè)數(shù)據(jù)分析完全自學(xué)教程
- gnuplot Cookbook
- Mastering LOB Development for Silverlight 5:A Case Study in Action
- 新手學(xué)會計(2013-2014實(shí)戰(zhàn)升級版)
- Spring MVC Beginner’s Guide
- Hands-On System Programming with C++
- Cognitive Computing with IBM Watson
- 量化投資:交易模型開發(fā)與數(shù)據(jù)挖掘
- 數(shù)據(jù)迷霧:洞察數(shù)據(jù)的價值與內(nèi)涵
- SQL Server 2012 數(shù)據(jù)庫教程(第3版)