Skip to content

torch

EinMesher

Bases: _EinMesher

EinMesher bound to the Torch backend. By default .mesh() will return PyTorch tensors without needing to pass a backend.

Source code in src/einmesh/torch.py
class EinMesher(_EinMesher):
    """
    EinMesher bound to the Torch backend. By default `.mesh()` will return PyTorch tensors
    without needing to pass a backend.
    """

    def __init__(self, pattern: str, **spaces: SpaceType):
        super().__init__(pattern, backend=TorchBackend(), **spaces)

    def sample(self) -> torch.Tensor | tuple[torch.Tensor, ...]:
        return super().sample()