Skip to content

PyTorch and Tensorflow implementation of inverse contrastive loss - https://arxiv.org/abs/2102.08343

License

Notifications You must be signed in to change notification settings

novice03/ic-loss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 

About

PyTorch and Tensorflow implementation of inverse contrastive loss - https://arxiv.org/abs/2102.08343

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages