mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
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.
28 lines
718 B
Python
28 lines
718 B
Python
from .module import Module
|
|
|
|
|
|
class CrossMapLRN2d(Module):
|
|
|
|
def __init__(self, size, alpha=1e-4, beta=0.75, k=1):
|
|
super(CrossMapLRN2d, self).__init__()
|
|
self.size = size
|
|
self.alpha = alpha
|
|
self.beta = beta
|
|
self.k = k
|
|
|
|
def forward(self, input):
|
|
return self._backend.CrossMapLRN2d(self.size, self.alpha, self.beta,
|
|
self.k)(input)
|
|
|
|
def __repr__(self):
|
|
return self.__class__.__name__ + ' (' \
|
|
+ ', alpha=' + str(self.alpha) \
|
|
+ ', beta=' + str(self.beta) \
|
|
+ ', k=' + str(self.k) \
|
|
+ ')'
|
|
|
|
|
|
# TODO: ContrastiveNorm2d
|
|
# TODO: DivisiveNorm2d
|
|
# TODO: SubtractiveNorm2d
|