 void logsoftmax_backward(int row, int col, const cnn::real *fx, const cnn::real *dEdf, cnn::real *dEdx, cnn::real * gpu_softmax, cnn::real *grd)
 {
     vexp(row * col, fx, gpu_softmax);
-    VectorSum(row, col, dEdf, grd, true); 
-    RowElementMultiplyWith(1, col, grd, row, col, gpu_softmax);
+    vector_sum(row, col, dEdf, grd, true);
+    row_element_multiply_with(1, col, grd, row, col, gpu_softmax);
 
     auto tb = SizeToBlockThreadPair(col * row);
     accBinaryExprKernel << <tb.first, tb.second >> >(col * row, dEdf, gpu_softmax, dEdx, FSubtract());

    cudaStream_t t_stream = cudaStreamDefault;
    cudaEvent_t done = nullptr;
    cudaEventCreate(&done);

    _assignColumnwiseSoftmaxOfBackward<cnn::real> << <col, MAX_THREADS_PER_BLOCK, 0, t_stream >> >(fx, dEdf, dEdx, col, row);

    cudaEventRecord(done);
    cudaEventSynchronize(done);

    }

    cudaEventCreate(&done);
    _vector_sum<cnn::real> << <blocksPerGrid, MAX_THREADS_PER_BLOCK, 0, cudaStreamDefault >> >(c, a, n, m, isColWise);
    cudaEventRecord(done);
    cudaEventSynchronize(done);
    cudaEventDestroy(done);
}

void vector_add_const(int rows, int cols, const cnn::real * a, int brow, int bcol, const cnn::real* b, cnn::real * c, bool isColWise)
{
    assert(rows > 0 && cols > 0); // converting from size_t to int may cause overflow

    int m = cols;
    int n = rows;

    if (brow != bcol && brow != 1)
        cuda_exception("const dimension has to be a scalar");

    cudaEvent_t done = nullptr;

    int blocksPerGrid = 0;
    if (isColWise) // col-wise
    {
        blocksPerGrid = (int)ceil(1.0 * m / MAX_THREADS_PER_BLOCK);
    }
    else
    {
        blocksPerGrid = (int)ceil(1.0 * n / MAX_THREADS_PER_BLOCK);
    }

    cudaEventCreate(&done);
    _vector_add_const<cnn::real> << <blocksPerGrid, MAX_THREADS_PER_BLOCK, 0, cudaStreamDefault >> >(c, a, n, m, b, isColWise);
    cudaEventRecord(done);
    cudaEventSynchronize(done);
    cudaEventDestroy(done);
}

/// assume that a is a vector with col dimension
void row_element_multiply_with(int arow, int acol, const cnn::real * a, int brow, int bcol, cnn::real * b)
{
    if (arow != 1 || acol != bcol)
    {
