 void coeffs_from_previous_layer(const float_type* __restrict__ expr_inf_coeff, const float_type* __restrict__ expr_sup_coeff, float_type* __restrict__ res_inf_coeff, float_type* __restrict__ res_sup_coeff, const float_type* __restrict__ aux_coeffs, const size_t num_out_neurons_current_layer, const size_t num_in_neurons_current_layer)
 {
     const size_t n = blockIdx.x;
-    const size_t j = blockIdx.y*blockDim.x + threadIdx.x;
-
-    if(j < num_in_neurons_current_layer)
+
+    size_t j = threadIdx.x;
+
+    float_type tmp1, tmp2;
+    float_type maxRes, maxMul;
+
+    while(j < num_in_neurons_current_layer)
     {
         const size_t b = n*num_in_neurons_current_layer + j;
 
         float_type inf_coeff = 0;
         float_type sup_coeff = 0;
-
-        float_type tmp1, tmp2;
-        float_type maxRes, maxMul;
 
         for(size_t i = 0; i < num_out_neurons_current_layer; i++)
         {

        {
            inf_coeff[a] = 0.0;
            sup_coeff[a] = 0.0;

            return;
        }
        else if(ub <= 0)
        {
            inf_coeff[a] = 0.0;
            sup_coeff[a] = 0.0;

            return;
        }
        else if(lb > 0)
        {

            atomicAdd(&inf_cst[n], tmp1);
            atomicAdd(&sup_cst[n], tmp1);
        }

        i += blockDim.x;
    }
}

