mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
[pep8] Fix most lint automatically with autopep8
Here's the command I used to invoke autopep8 (in parallel!): git ls-files | grep '\.py$' | xargs -n1 -P`nproc` autopep8 -i Several rules are ignored in setup.cfg. The goal is to let autopep8 handle everything which it can handle safely, and to disable any rules which are tricky or controversial to address. We may want to come back and re-enable some of these rules later, but I'm trying to make this patch as safe as possible. Also configures flake8 to match pep8's behavior. Also configures TravisCI to check the whole project for lint.
This commit is contained in:
@ -61,7 +61,7 @@ class BatchNorm1d(_BatchNorm):
|
||||
|
||||
During training, this layer keeps a running estimate of its computed mean
|
||||
and variance. The running sum is kept with a default momentum of 0.1.
|
||||
|
||||
|
||||
During evaluation, this running mean/variance is used for normalization.
|
||||
|
||||
Args:
|
||||
@ -82,6 +82,7 @@ class BatchNorm1d(_BatchNorm):
|
||||
>>> input = autograd.Variable(torch.randn(20, 100))
|
||||
>>> output = m(input)
|
||||
"""
|
||||
|
||||
def _check_input_dim(self, input):
|
||||
if input.dim() != 2 and input.dim() != 3:
|
||||
raise ValueError('expected 2D or 3D input (got {}D input)'
|
||||
@ -102,7 +103,7 @@ class BatchNorm2d(_BatchNorm):
|
||||
|
||||
During training, this layer keeps a running estimate of its computed mean
|
||||
and variance. The running sum is kept with a default momentum of 0.1.
|
||||
|
||||
|
||||
During evaluation, this running mean/variance is used for normalization.
|
||||
|
||||
Args:
|
||||
@ -123,6 +124,7 @@ class BatchNorm2d(_BatchNorm):
|
||||
>>> input = autograd.Variable(torch.randn(20, 100, 35, 45))
|
||||
>>> output = m(input)
|
||||
"""
|
||||
|
||||
def _check_input_dim(self, input):
|
||||
if input.dim() != 4:
|
||||
raise ValueError('expected 4D input (got {}D input)'
|
||||
@ -143,7 +145,7 @@ class BatchNorm3d(_BatchNorm):
|
||||
|
||||
During training, this layer keeps a running estimate of its computed mean
|
||||
and variance. The running sum is kept with a default momentum of 0.1.
|
||||
|
||||
|
||||
During evaluation, this running mean/variance is used for normalization.
|
||||
|
||||
Args:
|
||||
@ -164,6 +166,7 @@ class BatchNorm3d(_BatchNorm):
|
||||
>>> input = autograd.Variable(torch.randn(20, 100, 35, 45, 10))
|
||||
>>> output = m(input)
|
||||
"""
|
||||
|
||||
def _check_input_dim(self, input):
|
||||
if input.dim() != 5:
|
||||
raise ValueError('expected 5D input (got {}D input)'
|
||||
|
Reference in New Issue
Block a user