heart-fusion
用对偶共存(Dual $z = a + i \cdot b$)替换 Transformer argmax 的融合函数库。
核心思想
Transformer 末步 argmax「挑最大值」= 剔除变量:选了一个方向,另一个方向整个消失。 本库用融合函数让两个相反方向一起留下,合成一个不丢失任何一方的新整体。
铁律:禁止损失函数、禁止梯度下降、禁止奖励/惩罚、不寻求最优解、不允许剔除任何输入变量。
安装
pip install heart-fusion
快速示例
from heart_fusion import fuse, settle, fusion_decode, Pole
# 两极共存
d = fuse(0.8, 0.9) # 理智0.8 + 慈爱0.9
print(d.balance) # 0.99 (接近完美平衡)
print(d.is_harmonious()) # True
# 失衡 → 再合一自动收敛进和谐带
cold = fuse(1.0, 0.1) # 偏理智
settled, rounds = settle(cold)
print(settled.balance) # 0.56 (已进和谐带)
# 四极共存 (四元数扩展)
from heart_fusion import fuse_multi
q = fuse_multi(0.9, 0.8, 0.7, 0.6) # 理智/慈爱/逻辑/共情
print(q.balance) # ~0.99
# 替换 Transformer 末层 argmax
pole_a = Pole("理智", 0.85, "客观建议:建议你...")
pole_b = Pole("慈爱", 0.92, "温暖陪伴:我在你身边...")
result = fusion_decode(pole_a, pole_b)
print(result.output) # 两极共存, 没有任何一方被剔除
API
| 函数 | 说明 |
|---|---|
fuse(a, b) |
两极合一 → Dual |
settle(dual) |
收敛进和谐带 → (Dual, rounds) |
fuse_multi(*poles) |
n 极合一 → MultiDual |
settle_multi(dual) |
n 极收敛 → (MultiDual, rounds) |
fusion_decode(pole_a, pole_b) |
替换 argmax 的融合输出层 |
argmax_decode(pole_a, pole_b) |
旧范式(对比用) |
License
MIT
Metadata
Release files for heart-fusion 3.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| heart_fusion-3.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Release files / heart_fusion-3.1.3-py3-none-any.whl
| Download URL | heart_fusion-3.1.3-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa500ce0c44b6f61c64a4687f30f0915039e4bf645d033db3fcdaf996896c017
|
|
BLAKE2b-256 checksum How to use checksums |
264c7149afbdbd5968f1f0637924b0238cf24e05789ec735a56c810b351e485e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|
Security for heart-fusion 3.1.3
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.