Open Shayne-AuthMe opened 1 year ago
The implement of GRL maybe not correct?
https://github.com/wangzhuo2019/SSAN/blob/f4c2cbcd351a57766fc2ee7b83bde620c5cb00fc/networks/pub_mod.py#L7
The backword function is need to inherit torch.autograd.Function like this example in pytorch as follow:
backword
torch.autograd.Function
https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function
A simple implement might be:
from torch.autograd import Function class GRL(Function): @staticmethod def forward(ctx: Any, input: torch.Tensor): return input * 1.0 @staticmethod def backward(ctx: Any, gradOutput: torch.Tensor): return gradOutput.neg()
The implement of GRL maybe not correct?
https://github.com/wangzhuo2019/SSAN/blob/f4c2cbcd351a57766fc2ee7b83bde620c5cb00fc/networks/pub_mod.py#L7
The
backword
function is need to inherittorch.autograd.Function
like this example in pytorch as follow:https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function
A simple implement might be: