Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug #27

Open
afterall204168 opened this issue Mar 14, 2020 · 2 comments
Open

bug #27

afterall204168 opened this issue Mar 14, 2020 · 2 comments

Comments

@afterall204168
Copy link

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

@kevinghst
Copy link

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

@afterall204168
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants