topoloss
Project description
topoloss
Induce brain-like topographic structure in your neural networks
pip install topoloss
Example
import torchvision.models as models
from topoloss import TopoLoss, LaplacianPyramid
model = models.resnet18(weights = "DEFAULT")
topo_loss = TopoLoss(
losses = [
LaplacianPyramid(layer_name = 'fc',factor_h=3.0, factor_w=3.0),
],
)
print(topo_loss.compute(model=model, reduce_mean = True)) ## returns a single number as tensor for backward()
print(topo_loss.compute(model=model, reduce_mean = False)) ## returns a dict with layer names as keys
Running tests
pytest -vvx tests
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
topoloss-0.0.1.tar.gz
(7.2 kB
view details)
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 topoloss-0.0.1.tar.gz.
File metadata
- Download URL: topoloss-0.0.1.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2964a67279c6c5d54b81655f0ecdce4312fcbc7a64fb5d9a9a482f9d86e16a98
|
|
| MD5 |
149aa41ceae0638f94774f61f4531d18
|
|
| BLAKE2b-256 |
b56f58b991fd82d971d4c61ee0a86600ccba8383f9fd22d57b1ab69232869719
|
File details
Details for the file topoloss-0.0.1-py3-none-any.whl.
File metadata
- Download URL: topoloss-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65c6e883079b7108f40becdf674dadfe7e12399bee88997ddbb686d6081ca1e7
|
|
| MD5 |
768d658ccd5e1a7332c5ea6ccdc7d899
|
|
| BLAKE2b-256 |
45205dd4778c2eb5d33ba4a3fbf6c6616ab0c0f1418fa8c0c9b45d3e7f3cac7b
|