Implementation of inverse contrastive loss
Project description
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
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
ic_loss-1.0.1.tar.gz
(4.3 kB
view details)
Built Distribution
File details
Details for the file ic_loss-1.0.1.tar.gz
.
File metadata
- Download URL: ic_loss-1.0.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94e3dcc67846d645e0bce0afb323196b80e61dd393a51f1afabd78ef18af118e |
|
MD5 | d83228028f3ccb923c89d2b460ddc048 |
|
BLAKE2b-256 | 75f2f1a8a7b3ad2dab92ed75218cf89a5afc819a3258f59b33db91baebb3f150 |
File details
Details for the file ic_loss-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: ic_loss-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a075e03982eb92dc267797be9119c2dab9eed8fd8e3e995679e458b2b855cd3 |
|
MD5 | 3e1240396353f2f673e8c642bceeec5c |
|
BLAKE2b-256 | a416a3cccca5793d4d923f3f2d820d8de2c5d1ec348c111cdcf8c5b5d220f973 |