來自:
#include
#include
using namespace std;
int main()
;//定義卷積核矩陣(其實也是乙個陣列,陣列元素的個數3*3)
int const kernel = 3;
float b[kernel*kernel] =
;//計算卷積輸出矩陣的維數(其實是輸出陣列元素個數的開根號)
int const outm = map - kernel + 1; //被卷積矩陣的維數-卷積核的維數+1 即8-3+1=6
//計算卷積過程中的被卷積矩陣的寬和高(就是把寬拉成和卷積核的高一樣,這樣才好對應相乘)
int const convaw = kernel*kernel;//3*3=9
int const convah = map*map;//8*8=64
float a_convert[convah*convaw] = ;//定義乙個卷積過程中的矩陣(也就是被拉長過後的矩陣)
for (int i = 0; i < outm; i++)
}vectorc;
for (int i = 0; i < outm; i++)
c.push_back(a); //在c中新增資料a}}
//輸出被卷積矩陣
cout << "被卷積矩陣 :" << endl;
for (int i = 0; i < map; i++)
cout << endl;
}cout << endl;
//輸出卷積核矩陣
cout << "卷積核矩陣:" << endl;
for (int i = 0; i < kernel; i++)
cout << endl;
}cout << endl;
//輸出卷積後輸出矩陣
cout << "卷積後輸出矩陣:" << endl;
for (int i = 0; i < outm; i++)
cout << endl;
}system("pause");
return 0;
}
C語言實現線性卷積和圓周卷積
已知x n 求x n x n x n x n x n x n include graphics.h include include include include 線性卷積 void conv int x,int y else if m 4 m 0 else y n 1 x m x s 圓周卷積 n...
tensorflow實現卷積與反卷積自編碼框架
從dcgan中了解到了反卷積的操作,所以我本來打算能通過卷積操作作為編碼器將一幀影象轉換為乙個20維的向量,而後再通過反卷積實現解碼功能從而達到影象恢復效果,先把程式貼上,後續有空再調整網路層數和引數吧 from tensorflow.examples.tutorials.mnist import ...
反卷積實現 tensorflow 實現
deconv解卷積,實際是叫做conv transpose,conv transpose實際是卷積的乙個逆向過程,tf中,編寫conv transpose 的時候,心中想著乙個正向的卷積過程會很有幫助。想象一下我們有乙個正向卷積 input shape 1,5,5,3 kernel shape 2,...