在使用Tensorly進行CP分解中遇到的問題

2021-10-07 08:58:26 字數 751 閱讀 1265

撒花撒花!!!!終於把hdcm的卷積核分解完,並且執行速度的確提公升了,嘿嘿

先給乙個使用tensorly的parafac函式分解的例子:

x = tl.tensor(np.arange(24)

.astype(np.float64)

.reshape(3,

4,2)

)reslut = parafac(x, rank=

3)

發現有個問題,返回的reslut不是直接的三個矩陣,直接print的結果如下:

想要得到三個矩陣得這樣輸出結果:

f1, f2 = parafac(x, rank=3)

a,b,c = f2

這樣就得到cp分解後的三個矩陣,分別是a,b,c;隨便展示乙個a:

1)參考:

使用python tensorly 實現張量cp分解

pytorch中ndarray tensor list互轉

linux 使用cp進行複製

使用cp命令對檔案進行複製操作 在我們使用cp命令複製對乙個檔案進行操作的時候,必須要獲取到這個檔案的r許可權,否則就不能對這個檔案進行複製的操作了 root www tmp ls l copy file rw r r 1 root root 6 10 1517 03 copy file root ...

cp在makefile中使用

cp在makefile中使用 因為每次要把更新後的 複製到share資料夾 敲路徑麻煩,就像寫個makefile,每次make一下。如下 ccpp cp mnt hgfs share 很簡單乙個makefile檔案 結果make時出現 如下錯 cp 無法建立一般檔案 mnt hgfs shre 沒有...

在go modules裡使用go get進行包管理

首先我們介紹過go mod edit修改go.mod,然而它有兩點缺陷 好訊息是go get現在有了在modules中新增 修改 更新package的能力。想要完整體驗go modules,我們需要選擇乙個gopath以外的目錄,並且設定go11module on,這樣使用go get時只會影響當前...