comply to PEP 8

This commit is contained in:
Connor Olding 2018-03-24 06:26:02 +01:00
parent a685db1489
commit c6ebd02ea9
3 changed files with 11 additions and 10 deletions

View File

@ -130,8 +130,9 @@ class Gelu(Activation):
return X * self.cdf
def backward(self, dY):
return dY * (self.cdf \
+ np.exp(-_inv2 * np.square(self.X)) * self.X * _invsqrt2pi)
return dY * (self.cdf
+ np.exp(-_inv2 * np.square(self.X))
* self.X * _invsqrt2pi)
class Softmax(Activation):

View File

@ -31,7 +31,7 @@ class AddSignClip(Optimizer):
self.accum[:] = self.accum * self.mu + dW
signed = np.sign(dW) * np.sign(self.accum)
#signed *= decay
# signed *= decay
inter = dW * (self.alpha + signed)
@ -64,7 +64,7 @@ class PowerSignClip(Optimizer):
self.accum[:] = self.accum * self.mu + dW
signed = np.sign(dW) * np.sign(self.accum)
#signed *= decay
# signed *= decay
if self.use_exp:
inter = dW * np.exp(signed)

View File

@ -75,14 +75,14 @@ class Folding:
class_n = np.max(classes) + 1
sorted_inputs = np.array([inputs[classes == n]
for n in range(class_n)], inputs.dtype)
sorted_outputs = np.arange(class_n
).repeat(sorted_inputs.shape[1]).reshape(sorted_inputs.shape[:2])
sorted_outputs = np.arange(class_n) \
.repeat(sorted_inputs.shape[1]).reshape(sorted_inputs.shape[:2])
# now to interleave the classes instead of having them grouped:
inputs = np.swapaxes(sorted_inputs, 0, 1
).reshape(-1, *sorted_inputs.shape[2:])
outputs = np.swapaxes(sorted_outputs, 0, 1
).reshape(-1, *sorted_outputs.shape[2:])
inputs = np.swapaxes(sorted_inputs, 0, 1) \
.reshape(-1, *sorted_inputs.shape[2:])
outputs = np.swapaxes(sorted_outputs, 0, 1) \
.reshape(-1, *sorted_outputs.shape[2:])
# one final thing: we need to make our outputs one-hot again.
self.inputs = inputs