TorchBicop.from_bicop

classmethod TorchBicop.from_bicop(cop, cache_integrals=True, device=None, dtype=torch.float64)

Lifts a fitted Bicop into a TorchBicop.

The resulting TorchBicop is a torch.nn.Module (so .to("cuda") moves the density grid in one line) built from a differentiable bilinear interpolator, with autograd flowing through every pdf / cdf / hfunc / hinv call.

Parameters:
copBicop

A fitted Bicop of the TLL family at rotation=0 (the only shape TorchBicop represents directly). The density values are taken straight from cop.parameters; the grid coordinates come from InterpolationGrid2D.make_grid_points with the canonical Phi-spaced normal grid Bicop uses. The grid is already normalised, so renormalisation is skipped (parity is typically < 1e-12 per cell on fresh fits).

cache_integralsbool, default=True

See __init__.

devicetorch.device or None, default=None

See __init__.

dtypetorch.dtype, default=torch.float64

See __init__.

Returns:
TorchBicop

A TorchBicop mirroring cop.