boundlab.zono.bilinear_elementwise#
- boundlab.zono.bilinear_elementwise(A, B)[source]#
Linearize element-wise product of two symbolic expressions.
Both A and B must have the same shape.
The approximation is:
\[A \odot B \approx c_A \odot B + A \odot c_B - c_A \odot c_B + E\]with element-wise error bound:
\[|E| \le \mathrm{hw}(A) \odot \mathrm{hw}(B)\]- Parameters:
- Returns:
An expression over-approximating
A * B.- Return type:
Examples
>>> import torch >>> import boundlab.expr as expr >>> from boundlab.zono.bilinear import bilinear_elementwise >>> A = expr.ConstVal(torch.ones(3)) + 0.2 * expr.LpEpsilon([3]) >>> B = expr.ConstVal(torch.zeros(3)) + 0.3 * expr.LpEpsilon([3]) >>> C = bilinear_elementwise(A, B) >>> C.shape torch.Size([3])