surMSE is a A loss function @PyTorch, that allows the target to be exceeded in the target direction.
Project description
surMSE
A loss function @PyTorch, that allows the target to be exceeded in the target direction.
思路说明
允许输入与目标方向相同,但模长比目标大.此时损失为零.
因为神经网络经常表现出输出稍微不达目标的特性,通过减弱使输出接近零的梯度,尝试缓解这个问题.
Install
pip install surMSE
Use
from surMSE import surMSE
...
loss=surMSE(input,target,dim=None,scale=True,eps=1e-8,meanOut=True,haveBatch=True)
dim表示在哪些维度上计算损失,一般开启除Batch维之外的全部维度.设定为None则自动计算.
dim=None,haveBatch=True时,自动排除首维.dim=None,haveBatch=False时在全部维度上计算.
scale控制是否根据target模长控制对应样本损失的增益,如果开启,将通过target模长给损失加权;如果关闭,在一半空间上将等效于MSE.
meanOut控制是否在返回前使用平均的方法合并"dim"参数指定外的剩余维度.如果不开启,取决于数据维度和dim设置,返回的tensor将不一定只有一个元素.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file surmse-0.0.2.tar.gz.
File metadata
- Download URL: surmse-0.0.2.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2741c5b5b4af2fa18e473c1c394f9403fe41a5543f54011e4057d20a64e1e507
|
|
| MD5 |
03c36f94a223309ce9cccb0005b522fb
|
|
| BLAKE2b-256 |
efb7422d01cb4b7bdbfcfd13808461fb65cae1bb337b2d351f3d0030c91a3b94
|
Provenance
The following attestation bundles were made for surmse-0.0.2.tar.gz:
Publisher:
python-publish.yml on PsycheHalo/surMSE
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
surmse-0.0.2.tar.gz -
Subject digest:
2741c5b5b4af2fa18e473c1c394f9403fe41a5543f54011e4057d20a64e1e507 - Sigstore transparency entry: 1388957983
- Sigstore integration time:
-
Permalink:
PsycheHalo/surMSE@37644a953b6665f062dcc204d65223bf420c4bc0 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/PsycheHalo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@37644a953b6665f062dcc204d65223bf420c4bc0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file surmse-0.0.2-py3-none-any.whl.
File metadata
- Download URL: surmse-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bced3e14fdf33709b1afb0ad31b0cfb2e941ad857a2323616bf88e3df2330188
|
|
| MD5 |
21766a6121e401cf33f8163256a63708
|
|
| BLAKE2b-256 |
47cffa39b958c0bb9625500ad4a9c5daaf56357e2ed7967cb2aa847dc0a6dd25
|
Provenance
The following attestation bundles were made for surmse-0.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on PsycheHalo/surMSE
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
surmse-0.0.2-py3-none-any.whl -
Subject digest:
bced3e14fdf33709b1afb0ad31b0cfb2e941ad857a2323616bf88e3df2330188 - Sigstore transparency entry: 1388958055
- Sigstore integration time:
-
Permalink:
PsycheHalo/surMSE@37644a953b6665f062dcc204d65223bf420c4bc0 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/PsycheHalo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@37644a953b6665f062dcc204d65223bf420c4bc0 -
Trigger Event:
release
-
Statement type: