pytorch_revgrad

A pytorch module (and function) to reverse gradients.


Keywords
domain-adaptation, gradient-reversal, pytorch
License
MIT
Install
pip install pytorch_revgrad==0.0.1

Documentation

pytorch-revgrad

PyPI version Coverage Status ci status python version License: MIT

This package implements a gradient reversal layer for pytorch modules.

Example usage

import torch

from pytorch_revgrad import RevGrad

model = torch.nn.Sequential(
    torch.nn.Linear(10, 5),
    torch.nn.Linear(5, 2),
    RevGrad()
)