Synthetic Data #
This module provides deterministic tabular grids used by examples and tests. Domain-specific datasets and sample packing belong in their respective data modules.
Tabular grids #
def
TorchLean.Data.Synthetic.cartesianGrid
{α : Type}
[Storage α]
[Zero α]
{m n : ℕ}
(xCoordinates : Tensor α [m])
(yCoordinates : Tensor α [n])
:
Cartesian product of two vectors (batched tensor of points).
cartesianGrid xCoordinates yCoordinates produces a tensor X : (m*n, 2) containing all pairs
(x, y) with:
xtaken fromxCoordinates : (m,)ytaken fromyCoordinates : (n,)
Ordering is row-major: for each x in xCoordinates (outer loop), we sweep all y in
yCoordinates (inner loop).
PyTorch analogue: torch.cartesian_prod(xCoordinates, yCoordinates) (up to shape).
Instances For
def
TorchLean.Data.Synthetic.linspace
{α : Type}
[Storage α]
[Context α]
(lower upper : α)
(count : ℕ)
:
Linearly spaced points including endpoints.
linspace lo hi count returns a vector tensor of shape (count,):
- empty if
count = 0 [lo]ifcount = 1- otherwise
countpoints fromlotohi(inclusive).
PyTorch analogue: torch.linspace.