 
     const int ncols_u = ncols*k;
     const int ncols_x = (k == 3) ? ncols : ncols_u;
-    const scalar_t mask = (mask_c == NULL) ? 1.0 : (*(mask_c + col));
+    const scalar_t mask = (mask_c == NULL) ? (scalar_t)1.0 : (*(mask_c + col));
     auto cur = *(init + col);
     const int d2 = d*2;
     const auto wc1 = *(weight_c + (col%d2));

            const auto u0 = *up;
            const auto u1 = *(up + 1);
            const auto u2 = *(up + 2);
            const auto x_val = (skip_type) ? (*xp) : 0;
            const auto gh_val = *ghp;
            const auto g1 = sigmoidf(u1 + wc1*prev_c_val + bias1);
            const auto g2 = sigmoidf(u2 + wc2*prev_c_val + bias2);


    int ncols_u = ncols*k;
    int ncols_x = (k == 3) ? ncols : ncols_u;
    const scalar_t mask = (mask_c == NULL) ? (scalar_t)1.0 : (*(mask_c + col));
    scalar_t gwc1 = 0;
    scalar_t gwc2 = 0;
    scalar_t gbias1 = 0;
