     CUDA_CALL( cudaMemcpy( d_theta1, theta1,
                            sizeof(floatType_t)*theta1Rows*theta1Cols,
                            cudaMemcpyHostToDevice ) );
+    CUDA_CALL( cudaMemcpy( d_theta2, theta2,
+                           sizeof(floatType_t)*theta2Rows*theta2Cols,
+                           cudaMemcpyHostToDevice ) );
 //    CUDA_CALL( cudaMemcpy( d_srcData, z2, 
  //                          sizeof(floatType_t)*Xexamples*(theta1Rows+1),
   //                         cudaMemcpyHostToDevice ) );
 //    printf("rows %d cols %d\n",theta1Rows,theta1Cols);
 
-    float alpha = 1.0;
-    float beta  = 0.0;
 
 //    printHost(Xfeatures*Xexamples,1,X);
  //   printKernel<<<1,1>>>( Xfeatures*Xexamples, 1, d_X );

                                         theta1Rows+1,
                                         1,1) );

  floatType_t *d_srcData, *d_destData;
  CUDA_CALL( cudaMalloc( &d_srcData, 
          sizeof(floatType_t)*Xexamples*(theta1Rows+1)) );
  CUDA_CALL( cudaMemset( d_srcData, 0,
          sizeof(floatType_t)*Xexamples*(theta1Rows+1) ) );

  CUDA_CALL( cudaMalloc( &d_destData, 
          sizeof(floatType_t)*Xexamples*(theta1Rows+1)) );

  CUDA_CALL( cudaMemset( d_destData, 0,
          sizeof(floatType_t)*Xexamples*(theta1Rows+1) ) );

  floatType_t *d_X;
  CUDA_CALL( cudaMalloc( &d_X,

  yTemp = &a3[INDX(Xexamples,theta2Rows+1,Xexamples)];
  delta2 = &yTemp[11];

  floatType_t *d_tempMatrix;
  CUDA_CALL( cudaMalloc( &d_tempMatrix, sizeof(floatType_t) *
                               ( Xexamples * (theta1Rows+1) + 
                                 Xexamples * (theta1Rows+1) +
                                 Xexamples * (theta2Rows+1) + 
                                 theta2Cols + 11) ) ) ;

  floatType_t *d_z2, *d_a2, *d_a3, *d_yTemp, *d_delta2;
  d_z2 = d_tempMatrix;
  d_a2 = &d_z2[INDX(Xexamples,theta1Rows,Xexamples)];
  d_a3 = &d_a2[INDX(Xexamples,theta1Rows+1,Xexamples)];
  d_yTemp = &d_a3[INDX(Xexamples,theta2Rows+1,Xexamples)];
  d_delta2 = &d_yTemp[11];


  checkCUDNN( cudnnSetTensor4dDescriptor(srcTensorDesc,
                                         CUDNN_TENSOR_NCHW,
                                         CUDNN_DATA_FLOAT,
