Metadata-Version: 2.1
Name: ic-loss
Version: 1.0.1
Summary: Implementation of inverse contrastive loss
Home-page: https://github.com/novice03/ic-loss
Author: Pranav Pulijala
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown

## Inverse Contrastive Loss

Implementations of inverse contrastive loss from [Learning Invariant Representations using Inverse Contrastive Loss](https://arxiv.org/abs/2102.08343). 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

```bash
$ pip install ic-loss
```

## Usage

```python
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 

```

