SoLU - Softmax Linear Unit
This repository packages an implementation of Sofmax Linear Unit, as proposed in Softmax Linear Units.
Module Structure
SoLU -> SoLU, SoLULayer
Performance Penalty Mitigation
The original paper talks about a performance penalty with softmax linear unit which can be mitigated with an additional Layer Norm. This mitigation has been applied in the SoLULayer module in this package. The activation function itself is in the SoLU module.
Example Usage
Installation
pip install softmax-linear-unit
Code import
import torch
from SoLU import SoLULayer, SoLU
@torch.no_grad()
def main():
# batch_size=2, seq_len=5, hidden_dim=4
x = torch.randn(2, 5, 4)
# Initialize the layer (SoLU + LayerNorm)
solu_block = SoLULayer(hidden_size=4)
# Forward Pass
output = solu_block(x)
print(output)
print(output.size())
if __name__ == "__main__":
main()
You can also check main.py
Local Dev
Env
# make sure to have uv installed
# also python 3.12.11
uv sync
source .venv/bin/activate
Ruff and Pre-Commit
By default, pre-commit will run ruff formatting with the --fix flag.
pre-commit install
Metadata
Release files for softmax-linear-unit 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| softmax_linear_unit-1.2.0.tar.gz | 59.1 kB | Without provenance | Details for softmax_linear_unit-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| softmax_linear_unit-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for softmax_linear_unit-1.2.0-py3-none-any.whl |
Total release size: 64.8 kB
Release files / softmax_linear_unit-1.2.0.tar.gz
| Download URL | softmax_linear_unit-1.2.0.tar.gz |
|---|---|
| Size | 59.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a51f6ee7ba9644b6cd84b8566ad90193aef04bc34d372ddbadbe601d8c217afe
|
|
BLAKE2b-256 checksum How to use checksums |
639c230e20134f1370ba024b68905b2c936383512509ba153654f38215f0c5e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / softmax_linear_unit-1.2.0-py3-none-any.whl
| Download URL | softmax_linear_unit-1.2.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c7b8a1d8e1cdf57eb6a1423cbe6abbf9a3e123232c6f80358534e215cdaa06f
|
|
BLAKE2b-256 checksum How to use checksums |
dbd4393096b5e2af3b16a11e800b194f1815211d14b671e615181cc6d16bd709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for softmax-linear-unit 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.