boundlab.gradlin.gradlin#

boundlab.gradlin.gradlin(f, lx, ux, ly, uy, ld, ud, *, num_samples=16, num_starts=1, lam_init=None, use_gurobi=True, iters=40, lr=0.05, generator=None)[source]#

Estimate lam_x, lam_y, L, U for a batched trapezoid.

Parameters:
  • f (Callable[[torch.Tensor], torch.Tensor]) – Unary function accepting tensors of shape (*batch, S).

  • lx (torch.Tensor) – Batched trapezoid parameters with shape (*batch,).

  • ux (torch.Tensor) – Batched trapezoid parameters with shape (*batch,).

  • ly (torch.Tensor) – Batched trapezoid parameters with shape (*batch,).

  • uy (torch.Tensor) – Batched trapezoid parameters with shape (*batch,).

  • ld (torch.Tensor) – Batched trapezoid parameters with shape (*batch,).

  • ud (torch.Tensor) – Batched trapezoid parameters with shape (*batch,).

  • num_samples (int) – Number of sample points used to estimate the slopes.

  • num_starts (int) – Number of Adam restarts used when searching for the extrema.

  • lam_init (torch.Tensor | None) – Optional warm start for (lam_x, lam_y) with shape (*batch, 2).

Returns:

  • lam ((*batch, 2))

  • L, U ((*batch,))

Return type:

tuple[torch.Tensor, torch.Tensor, torch.Tensor]