quantdata.utils.cvxpy#
CVXPY Utilities#
- quantdata.utils.cvxpy.patch_cvxpy_sum_shape_from_args()[source]#
Patch CVXPY’s Sum.shape_from_args() to avoid reducing uninitialized memory.
CVXPY 1.8.2 computes the output shape of cp.sum() by calling
np.sum(np.empty(shape)). With NumPy 2.4 this can raise a spuriousRuntimeWarning: overflow encountered in reducewhile the expression is being validated. Replacingnp.emptywithnp.zerospreserves the shape inference while avoiding the warning.Returns
Truewhen the patch is applied andFalsewhen it is already active.