This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./perceptron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nvcc -arch=sm_50 -rdc=true -lcudadevrt onehiddenlayerperceptron.cu -o perceptron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prediction[0] : 0.060997 True Value[0] : 0.000000 Error[0] : 0.060997 | |
Prediction[1] : 0.076193 True Value[1] : 0.000000 Error[1] : 0.076193 | |
Prediction[2] : 0.927551 True Value[2] : 1.000000 Error[2] : -0.072449 | |
Prediction[3] : 0.918263 True Value[3] : 1.000000 Error[3] : -0.081737 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dDot_m1T_m2( X, l_1_d, W0, X_h, X_w, l1_w ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__global__ void kDot_m1_m2T(const float *m1, const float *m2, float *output, const int m1_columns, const int m2_rows ){ | |
/* Updates the output matrix with the product of two matrices: m1 and m2 transposed. | |
Inputs: | |
m1: array, left matrix of size m1_rows x m1_columns | |
m2: array, right matrix of size m2_rows x m1_columns (m2 transposed will be of size m1_columns x m2_rows) | |
output: array, the results of the computation are to be stored here: | |
m1 * m2, product of two arrays m1 and m2, a matrix of size m1_rows x m2_rows | |
m1_columns: int, number of columns in the left matrix m1 | |
m2_rows: int, number of rows in the left matrix m2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dMartixByMatrixElementwise(dDot_m1_m2T(pred_d, W1, l_1_d, X_h, y_w, l1_w), dSigmoid_d(l1, buffer, X_h, l1_w), l_1_d, X_h, l1_w); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__global__ void kMartixByMatrixElementwise(const float *m1, const float *m2, float *output) { | |
/* Computes the product of two arrays (elementwise multiplication). | |
Inputs: | |
m1: array | |
m2: array | |
output: array,the results of the multiplication are to be stored here | |
*/ | |
const int id = blockIdx.x * blockDim.x + threadIdx.x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__global__ void kMartixSubstractMatrix(const float *m1, const float *m2, float *output) { | |
/* Computes the (elementwise) difference between two arrays | |
Inputs: | |
m1: array | |
m2: array | |
output: array,the results of the computation are to be stored here | |
*/ | |
const int id = blockIdx.x * blockDim.x + threadIdx.x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dMartixByMatrixElementwise(dMartixSubstractMatrix(y, pred, pred_d, X_h, y_w), dSigmoid_d(pred, buffer, X_h, y_w), pred_d, X_h, y_w ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dSigmoid(dDot(l1, W1, pred, X_h, l1_w, y_w), pred, X_h, y_w); |