 static unsigned int classify(double data[28][28])
 {
 	float res[10];
+
 	propagate(data);
 
 	unsigned int max = 0;


		cudaMalloc(&weight, sizeof(float) * M * N);

		cudaMalloc(&d_output, sizeof(float) * N);
		cudaMalloc(&d_preact, sizeof(float) * N);
		cudaMalloc(&d_weight, sizeof(float) * M * N);

		cudaMemcpy(bias, h_bias, sizeof(float) * N, cudaMemcpyHostToDevice);

	{
		cudaMemcpy(output, data, sizeof(float) * O, cudaMemcpyHostToDevice);
	}

	void clear()
	{
		cudaMemset(output, 0x00, sizeof(float) * O);
		cudaMemset(preact, 0x00, sizeof(float) * O);
	}

	void bp_clear()
	{
		cudaMemset(d_output, 0x00, sizeof(float) * O);
		cudaMemset(d_preact, 0x00, sizeof(float) * O);
		cudaMemset(d_weight, 0x00, sizeof(float) * M * N);
	}
};

static cublasHandle_t blas;
static Layer l_input(0, 0, 28*28), l_c1(5*5, 6, 24*24*6), l_s1(4*4, 1, 6*6*6), l_f(6*6*6, 10, 10);

__device__ float step_function(float v)
{
	return 1 / (1 + exp(-v));
}

__global__ void apply_step_function(float *input, float *output, const int N)
{
	const int pos = blockIdx.x * blockDim.x + threadIdx.x;
	const int size = blockDim.x * gridDim.x;

	for (int idx = N * pos / size; idx < N * (pos+1) / size; ++idx) {
		output[idx] = step_function(input[idx]);
	}
}

