Project: pytorch-revgrad

A pytorch module (and function) to reverse gradients.

Project Details

Latest version
0.2.0
Home Page
https://github.com/janfreyberg/pytorch-revgrad
PyPI Page
https://pypi.org/project/pytorch-revgrad/

Project Popularity

PageRank
0.002852842455008901
Number of downloads
59031

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()
)