We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi i get error while running the below class at code x.var((0,2,3),keepdim=True) var(): argument 'dim' (position 1) must be int, not tuple
class BatchNorm(nn.Module): def __init__(self, nf, mom=0.1, eps=1e-5): super().__init__() # NB: pytorch bn mom is opposite of what you'd expect self.mom,self.eps = mom,eps self.mults = nn.Parameter(torch.ones (nf,1,1)) self.adds = nn.Parameter(torch.zeros(nf,1,1)) self.register_buffer('vars', torch.ones(1,nf,1,1)) self.register_buffer('means', torch.zeros(1,nf,1,1)) def update_stats(self, x): print(x.size()) m = x.mean((0,2,3), keepdim=True) print(m.size()) v = x.var((0,2,3), keepdim=True) # This gives syntax error saying Var() needs dim as int but tuple given self.means.lerp_(m, self.mom) self.vars.lerp_ (v, self.mom) return m,v def forward(self, x): if self.training: with torch.no_grad(): m,v = self.update_stats(x) else: m,v = self.means,self.vars x = (x-m) / (v+self.eps).sqrt() return x*self.mults + self.adds
The text was updated successfully, but these errors were encountered:
Has the same problem
Sorry, something went wrong.
this was issue with pytorch version. Fixed it by installing it from knightly.html link
No branches or pull requests
Hi i get error while running the below class
at code x.var((0,2,3),keepdim=True)
var(): argument 'dim' (position 1) must be int, not tuple
The text was updated successfully, but these errors were encountered: