 const size_t maximum_backstep = 2;
 
 const size_t num_threads = 256;
+
+bool retain_bounds = true;
 
 #define FULL_MASK 0xffffffff
 

}


void update_state_using_predecessor_layer_sparse(fppoly_internal_t* pr, fppoly_t* fp, float_type** linf_coeff, float_type** lsup_coeff, float_type** linf_cst, float_type** lsup_cst, float_type** uinf_coeff, float_type** usup_coeff, float_type** uinf_cst, float_type** usup_cst, float_type** linf_coeff_tmp, float_type** lsup_coeff_tmp, float_type** linf_cst_tmp, float_type** lsup_cst_tmp, float_type** uinf_coeff_tmp, float_type** usup_coeff_tmp, float_type** uinf_cst_tmp, float_type** usup_cst_tmp, const size_t layerno, const size_t k, const bool use_area_heuristic, const size_t x_y_size_last_layer, const size_t num_filters_last_layer, const size_t num_chunks, long int& offset_x, long int& offset_y, long int& length_x, long int& length_y, long int& shift_x, long int& shift_y)
{
    const size_t num_out_neurons_current_layer = fp->layers[k]->num_out_neurons;

            compute_ub_from_expr_conv_sparse<<<dim3(fp->layers[layerno]->output_size[0], fp->layers[layerno]->output_size[1], fp->layers[layerno]->output_size[2]/num_chunks), fp->layers[0]->input_size[2]>>>(ub_array, uinf_coeff, usup_coeff, usup_cst, fp->input_inf, fp->input_sup, num_chunks, chunk_counter, fp->layers[0]->input_size[0], fp->layers[0]->input_size[1], fp->layers[0]->input_size[2], offset_x, offset_y, length_x, length_y, shift_x, shift_y);
        }
    }

    if(retain_bounds)
    {
        float_type* lcoeff_host = (float_type*) malloc(x_y_size_last_layer*num_filters_last_layer*length_x*length_y*fp->layers[0]->input_size[2]*sizeof(float_type));
        float_type* ucoeff_host = (float_type*) malloc(x_y_size_last_layer*num_filters_last_layer*length_x*length_y*fp->layers[0]->input_size[2]*sizeof(float_type));

        cudaMemcpy(lcoeff_host, linf_coeff, x_y_size_last_layer*num_filters_last_layer*length_x*length_y*fp->layers[0]->input_size[2]*sizeof(float_type), cudaMemcpyDeviceToHost);
        cudaMemcpy(ucoeff_host, usup_coeff, x_y_size_last_layer*num_filters_last_layer*length_x*length_y*fp->layers[0]->input_size[2]*sizeof(float_type), cudaMemcpyDeviceToHost);

        float_type* lcst_host = (float_type*) malloc(x_y_size_last_layer*num_filters_last_layer*sizeof(float_type));
        float_type* ucst_host = (float_type*) malloc(x_y_size_last_layer*num_filters_last_layer*sizeof(float_type));

        cudaMemcpy(lcst_host, linf_cst, x_y_size_last_layer*num_filters_last_layer*sizeof(float_type), cudaMemcpyDeviceToHost);
        cudaMemcpy(ucst_host, usup_cst, x_y_size_last_layer*num_filters_last_layer*sizeof(float_type), cudaMemcpyDeviceToHost);

        const int output_size_x = fp->layers[layerno]->output_size[0];
        const int output_size_y = fp->layers[layerno]->output_size[1];
        const int output_size_z = fp->layers[layerno]->output_size[2];

        const int input_size_x = fp->layers[0]->input_size[0];
        const int input_size_y = fp->layers[0]->input_size[1];
        const int input_size_z = fp->layers[0]->input_size[2];

        print_coeffs(lcoeff_host, ucoeff_host, output_size_x, output_size_y, output_size_z, input_size_x, input_size_y, input_size_z, length_x, length_y, shift_x, shift_y, offset_x, offset_y);

        free(lcoeff_host);
        free(ucoeff_host);

        free(lcst_host);
        free(ucst_host);

        lcoeff_host = nullptr;
        ucoeff_host = nullptr;

        lcst_host = nullptr;
        ucst_host = nullptr;
    }

    retain_bounds = false;

    cudaFree(linf_coeff);
    cudaFree(lsup_coeff);
