hoptorch
Compatibility helpers for PyTorch higher-order operators.
Decision gist · record as of 2026-08-14
Yes, if you need scan and want version/device safety. The low install friction, permissive license, and active maintenance make it reasonable. However, it is early-stage (Alpha) with minimal real-world usage; test thoroughly in your environment before relying on it in production.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires torch>=2.7 and pyvers>=0.2.2; Python >=3.10
- Low friction: pure Python wheel with only torch and pyvers as runtime dependencies.
- Active maintenance with recent release, though early-stage (Alpha) and minimal community adoption.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions.
last release 2026-06-05 (70 days) · last repo commit 2026-06-05 · 1 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 87,914 downloads/mo, #13,761 on PyPI
Alternatives
Verify before relying
pip install hoptorch
import torch
from hoptorch import scan
from hoptorch.scan import ensure_scan_backward
if ensure_scan_backward("cpu"):
xs = torch.arange(4.0)
def step(carry, x):
next_carry = carry + x
return next_carry, next_carry.clone()
carry, ys = scan(step, torch.zeros(()), xs)- Whether the eager scan backport for PyTorch 2.7 covers all use cases or has known limitations.
- Real-world performance overhead of the health check and lazy patching on typical scan workloads.
- Scope of PyTorch internals patched and stability across minor PyTorch releases.
What it is and what it does
hoptorch is a thin compatibility layer for PyTorch's scan operator, which is part of PyTorch's higher-order operator suite. It wraps torch._higher_order_ops.scan with a health check that verifies scan backward is working on your device before you use it, then lazily applies version-specific patches to PyTorch internals if needed. For PyTorch 2.7, where scan backward is not yet implemented, hoptorch provides a small eager scan implementation that uses ordinary autograd instead.
The package is designed to let you write scan code once and have it work reliably across PyTorch versions and devices. It includes utilities to check whether scan is available, to warm the health check before torch.compile, and to inspect why scan might be unavailable on a given device. The health check fails closed during Dynamo tracing to avoid false positives.
Use it for
- Use it to safely call torch.scan in production code without worrying about device-specific or version-specific backward failures.
- Use it to backport scan functionality to PyTorch 2.7 environments where native scan backward is not available.
- Use it to warm scan health checks before compiling functions with torch.compile to avoid tracing overhead.
- Use it to diagnose why scan backward is unavailable on a specific device or PyTorch version.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need scan and want version/device safety.
The low install friction, permissive license, and active maintenance make it reasonable. However, it is early-stage (Alpha) with minimal real-world usage; test thoroughly in your environment before relying on it in production.
Install
hoptorch on PyPI
Before you install
Low friction: pure Python wheel with only torch and pyvers as runtime dependencies. Active maintenance with recent release, though early-stage (Alpha) and minimal community adoption.
Requires torch>=2.7 and pyvers>=0.2.2; Python >=3.10
License in practice
MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions.
Quickstart
pip install hoptorch
import torch
from hoptorch import scan
from hoptorch.scan import ensure_scan_backward
if ensure_scan_backward("cpu"):
xs = torch.arange(4.0)
def step(carry, x):
next_carry = carry + x
return next_carry, next_carry.clone()
carry, ys = scan(step, torch.zeros(()), xs)
Verify before relying
- Whether the eager scan backport for PyTorch 2.7 covers all use cases or has known limitations.
- Real-world performance overhead of the health check and lazy patching on typical scan workloads.
- Scope of PyTorch internals patched and stability across minor PyTorch releases.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagestorchpyvers |
| Maintenance | Actively maintained 70 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 87,914 / month, #13,761 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaIntended Audience :: DevelopersIntended Audience :: Science/ResearchProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Software Development :: Libraries :: Python Modules |
Evidence: hoptorch-0.1.4-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytorch scan operator wrapper”
- hoptorchProvides a safe wrapper around PyTorch's scan operator that checks…
- picklescanScans Python Pickle files and related serialized model formats to…
- torch-directmlEnables PyTorch to use DirectML for GPU acceleration on DirectX…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also torch · torch-einops-utils · cuequivariance-ops-torch-cu12 · torch-npu · pytorch · onnx2torch · torchviz · depyf · torch-directml · opt-einsum-fx