| """Lightweight stub of torch package for static analysis and testing without native backend. | |
| This provides minimal classes and functions used in the repository to avoid import errors. | |
| """ | |
| from typing import Any | |
| # tensor type alias | |
| class Tensor: | |
| def __init__(self, data: Any): | |
| self.data = data | |
| def tensor(data, dtype=None): | |
| return Tensor(data) | |
| # expose a minimal nn and optim modules via lazy imports | |
| from . import nn # type: ignore | |
| from . import optim # type: ignore | |