Inverse Contrastive Loss
Implementations of inverse contrastive loss from Learning Invariant Representations using Inverse Contrastive Loss. The model architecture used on the ADNI dataset in the paper is also included along with PyTorch and Tensorflow implementations of the loss function.
Installation
$ pip install ic-loss
Usage
import torch
from ic_loss.losses import icl, icl_tf # icl - pytorch, icl_tf - tensorflow
from ic_loss.models import ADNIResNet # ADNIResNet - pytroch model used in the paper
model = ADNIResNet()
x = torch.randn([1, 1, 512, 512])
logits, latent = model(x)
loss = icl(latent, c) # c - extraneous attribute
Release files for ic-loss 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ic_loss-1.0.1.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ic_loss-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / ic_loss-1.0.1.tar.gz
| Download URL | ic_loss-1.0.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94e3dcc67846d645e0bce0afb323196b80e61dd393a51f1afabd78ef18af118e
|
|
BLAKE2b-256 checksum How to use checksums |
75f2f1a8a7b3ad2dab92ed75218cf89a5afc819a3258f59b33db91baebb3f150
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.9
|
Release files / ic_loss-1.0.1-py3-none-any.whl
| Download URL | ic_loss-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a075e03982eb92dc267797be9119c2dab9eed8fd8e3e995679e458b2b855cd3
|
|
BLAKE2b-256 checksum How to use checksums |
a416a3cccca5793d4d923f3f2d820d8de2c5d1ec348c111cdcf8c5b5d220f973
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.9
|