MixMatch-pytorch icon indicating copy to clipboard operation
MixMatch-pytorch copied to clipboard

bug

Open afterall204168 opened this issue 5 years ago • 2 comments

RuntimeError: result type Float can't be cast to the desired output type Long

afterall204168 avatar Mar 14 '20 01:03 afterall204168

has anyone found the solution to this bug? I also encountered it.

kevinghst avatar Apr 05 '20 14:04 kevinghst

has anyone found the solution to this bug? I also encountered it. I solved this issue by the following code (add a "if" statement).

    for param, ema_param in zip(self.params, self.ema_params):
        if ema_param.dtype==torch.float32:
            ema_param.mul_(self.alpha)
            ema_param.add_(param * one_minus_alpha)
            # customized weight decay
            param.mul_(1 - self.wd)

afterall204168 avatar Apr 06 '20 00:04 afterall204168