 
 			//call our gradient kernel
 			gradientAndDirection << <grid_size, block_size >> >(d_in, d_gradient, d_theta, d_kgx, d_kgy, numRows, numCols);
-			//for now just testing gradient. 
+			//synchronize the device. 
 			cudaDeviceSynchronize(); checkCudaErrors(cudaGetLastError());
+			//for now just testing gradient part so copy this result to the output. 
 			checkCudaErrors(cudaMemcpy(static_cast<uint16_t*>(output.data()), d_gradient, output.totalSize(), cudaMemcpyDeviceToHost));
 
 			//free up used memory. 

			checkCudaErrors(cudaFree(d_out));
			checkCudaErrors(cudaFree(d_filter));

			free(h_filter);
			break;
		}
		

		checkCudaErrors(cudaFree(d_kgy));

		//free cpu memory. 
		delete[] k_gx;
		delete[] k_gy;

	}
}

