Registry / ai-ml / entmax

entmax

JSON →
library1.3pypypiunverified

A family of sparse alternatives to softmax, including entmax, sparsemax, normmax, and budget, with corresponding loss functions. Current version: 1.3. Release cadence is irregular, with updates as needed for bug fixes and new activations.

pip install entmax
INSTALL
IMPORT
SIG · ENTMAX
E
entmax
ai-mlpythonv1.3
Install
67.3s avg
Import
Disk
4787MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 74.5s
py 3.11
✕ build_error
✓ 69.5s
py 3.12
✕ build_error
✓ 67.3s
py 3.13
✕ build_error
✓ 57.8s
py 3.9
✕ build_error
✕ timeout
4787MB installed
● package 4787MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

entmax_loss
from entmax import entmax_loss
Official import path for the entmax loss function.
Sparsemax
from entmax import Sparsemax
Official import path for the Sparsemax activation layer.

Apply entmax-1.5 activation and the generic bisection-based entmax function.

import torch from entmax import entmax15, entmax_bisect x = torch.randn(2, 5) y = entmax15(x, dim=-1) print(y) z = entmax_bisect(x, alpha=1.5, dim=-1) print(z)
Debug
Known issues
gotchaentmax 1.x requires PyTorch to be installed before installation. Attempting to install entmax without torch will fail. Use conda or pip to install PyTorch first.
fix
Install PyTorch first: pip install torch. Then proceed with pip install entmax.
affects: <=1.3
gotchaThe bisection-based functions (entmax_bisect, etc.) are slower than the closed-form variants. They are intended for non-standard alpha values (not 1.5 or 2).
fix
Use entmax15 or Sparsemax for standard alphas; use bisection only for custom alphas.
affects: >=1.0
deprecatedThe 'alpha' parameter in some older functions is deprecated; use the specific entmax15 or Sparsemax functions instead.
fix
Migrate to entmax15 (alpha=1.5) or Sparsemax (alpha=2).
affects: <=1.2
Upgrade
Version history
1.3latest on PyPI · released Feb 7, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
16
OpenAI (training)
1
Resources
entmax — pip install entmax · libregistry