728x90
반응형
#include <stdio.h>
void dnn_test();
void backward_WE(double* WE, double* X, double* YE, int M, int N);
void print(const char* s, double* W, int M, int N);
const int M = 2;
const int N = 2;
double X[N] = { 2, 3 };
double YE[M] = { -8, 60 };
double WE[M][N] = { 0, };
int main(void)
{
dnn_test();
return 0;
}
void dnn_test()
{
backward_WE((double*)WE, X, YE, M, N);
print("WE = ", (double*)WE, M, N);
}
void backward_WE(double* WE, double* X, double* YE, int M, int N)
{
for (int m = 0; m < M; m++)
{
for (int n = 0; n < N; n++)
WE[m * N + n] = X[m] * YE[n];
}
}
void print(const char* s, double* W, int M, int N)
{
printf("%s [\n", s);
for (int m = 0; m < M; m++)
{
printf("[%s", s);
for (int n = 0; n < N - 1; n++)
{
printf("%.3f", W[m * N + n]);
}
printf("%.3f]\n", W[m * N + N - 1]);
}
printf("]\n");
}
가중치 역전파
728x90
반응형
'Deep Learning' 카테고리의 다른 글
Deep Learning Basic Formula - 2input, 2output (epoch 1 ~ 200) (0) | 2022.08.24 |
---|---|
Deep Learning Basic Formula - 2input, 1output (epoch 1 ~ 200) (0) | 2022.08.23 |
Deep Learning Basic Formula - 1input, 1output (epoch 1 ~ 200) (0) | 2022.08.23 |
Deep Learning Library (0) | 2022.08.23 |
Mean Squared Error : MSE (0) | 2022.08.23 |