This package implements a gradient reversal layer for pytorch modules.
import torch
from pytorch_revgrad import RevGrad
model = torch.nn.Sequential(
torch.nn.Linear(10, 5),
torch.nn.Linear(5, 2),
RevGrad()
)
A minimal pytorch package implementing a gradient reversal layer.
This package implements a gradient reversal layer for pytorch modules.
import torch
from pytorch_revgrad import RevGrad
model = torch.nn.Sequential(
torch.nn.Linear(10, 5),
torch.nn.Linear(5, 2),
RevGrad()
)
A minimal pytorch package implementing a gradient reversal layer.
MIT License