 }
 
 
+void conv_handle_intermediate_layer(elina_manager_t* man, elina_abstract0_t* element, const double* filter_weights, const double* filter_bias, const size_t* input_size, const size_t* filter_size, const size_t num_filters, const size_t* strides, const bool is_valid_padding, const bool has_bias, size_t* predecessors, const activation_type_t activation, const bool use_area_heuristic)
+{
+    fppoly_t* const fp = fppoly_of_abstract0(element);
+
+    layer_create_sparse_exprs(fp, filter_weights, filter_bias, input_size, filter_size, num_filters, strides, is_valid_padding, has_bias, activation);
+
+    fp->layers[fp->numlayers - 1]->predecessors = predecessors;
+
+    update_state_using_previous_layers_conv(man, fp, fp->numlayers - 1, use_area_heuristic);
+}
+
+
 void conv_handle_intermediate_relu_layer(elina_manager_t* man, elina_abstract0_t* element, const double* filter_weights, const double* filter_bias, const size_t* input_size, const size_t* filter_size, const size_t num_filters, const size_t* strides, const bool is_valid_padding, const bool has_bias, size_t* predecessors, const bool use_area_heuristic)
 {
-    fppoly_t* const fp = fppoly_of_abstract0(element);
-
-    layer_create_sparse_exprs(fp, filter_weights, filter_bias, input_size, filter_size, num_filters, strides, is_valid_padding, has_bias);
-
-    fp->layers[fp->numlayers - 1]->predecessors = predecessors;
-
-    update_state_using_previous_layers_conv(man, fp, fp->numlayers - 1, use_area_heuristic);
+	conv_handle_intermediate_layer(man, element, filter_weights, filter_bias, input_size, filter_size, num_filters, strides, is_valid_padding, has_bias, predecessors, RELU, use_area_heuristic);
+}
+
+
+void conv_handle_intermediate_affine_layer(elina_manager_t* man, elina_abstract0_t* element, const double* filter_weights, const double* filter_bias, const size_t* input_size, const size_t* filter_size, const size_t num_filters, const size_t* strides, const bool is_valid_padding, const bool has_bias, size_t* predecessors, const bool use_area_heuristic)
+{
+	conv_handle_intermediate_layer(man, element, filter_weights, filter_bias, input_size, filter_size, num_filters, strides, is_valid_padding, has_bias, predecessors, NONE, use_area_heuristic);
 }
 
 

                std::swap(shift_y, copy_shift_y);
            }

            add_coeffs_and_csts_sparse<<<dim3(fp->layers[layerno]->output_size[0], fp->layers[layerno]->output_size[1], fp->layers[layerno]->output_size[2]/num_chunks), 1>>>(linf_coeff, lsup_coeff, linf_cst, lsup_cst, copy_linf_coeff, copy_lsup_coeff, copy_linf_cst, copy_lsup_cst, length_x, length_y, copy_length_x, copy_length_y,  fp->layers[common_predecessor + 1]->input_size[2], copy_offset_x - offset_x, copy_offset_y - offset_y);
            add_coeffs_and_csts_sparse<<<dim3(fp->layers[layerno]->output_size[0], fp->layers[layerno]->output_size[1], fp->layers[layerno]->output_size[2]/num_chunks), 1>>>(uinf_coeff, usup_coeff, uinf_cst, usup_cst, copy_uinf_coeff, copy_usup_coeff, copy_uinf_cst, copy_usup_cst, length_x, length_y, copy_length_x, copy_length_y,  fp->layers[common_predecessor + 1]->input_size[2], copy_offset_x - offset_x, copy_offset_y - offset_y);
            // Assume at least one non-residual layer between two residual layers

            cudaFree(copy_linf_coeff);

    layer->strides = nullptr;
    layer->pad = nullptr;

    free(layer);
    layer = nullptr;
}
