-
Notifications
You must be signed in to change notification settings - Fork 1
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
Sourcery Starbot ⭐ refactored manncodes/xeno #1
base: master
Are you sure you want to change the base?
Conversation
last_forward = input if input else self.last_forward | ||
last_forward = input or self.last_forward |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ReLU.derivative
refactored with the following changes:
- Simplify if expression by using or (
or-if-exp-identity
)
last_forward = input if input else self.last_forward | ||
last_forward = input or self.last_forward |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Linear.derivative
refactored with the following changes:
- Simplify if expression by using or (
or-if-exp-identity
)
s = exp_x / np.sum(exp_x, axis=1, keepdims=True) | ||
return s | ||
return exp_x / np.sum(exp_x, axis=1, keepdims=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Softmax.forward
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
last_forward = input if input else self.last_forward | ||
last_forward = input or self.last_forward |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Softmax.derivative
refactored with the following changes:
- Simplify if expression by using or (
or-if-exp-identity
)
elif len(size) == 4 or len(size) == 5: | ||
elif len(size) in [4, 5]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function decompose_size
refactored with the following changes:
- Replace multiple comparisons of same variable with
in
operator (merge-comparisons
)
iter_idx = 0 | ||
while iter_idx < max_iter: | ||
iter_idx += 1 | ||
|
||
for iter_idx in range(1, max_iter + 1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Model.fit
refactored with the following changes:
- Replace while with for (
while-to-for
)
y_pred = x_next | ||
return y_pred | ||
return x_next |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Model.predict
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
act_out = self.act_layer.forward(linear_out) | ||
return act_out | ||
return self.act_layer.forward(linear_out) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Dense.forward
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
if train: | ||
self.last_mask = get_rng().binomial(1, 1 - self.p, input.shape) / (1 - self.p) | ||
return input * self.last_mask | ||
else: | ||
if not train: | ||
return input * (1 - self.p) | ||
self.last_mask = get_rng().binomial(1, 1 - self.p, input.shape) / (1 - self.p) | ||
return input * self.last_mask |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Dropout.forward
refactored with the following changes:
- Swap if/else branches (
swap-if-else-branches
) - Remove unnecessary else after guard condition (
remove-unnecessary-else
)
# step0 done! | ||
dx = dx1 + dx2 | ||
|
||
return dx | ||
return dx1 + dx2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function BatchNormal.backward
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
This removes the following comments ( why? ):
# step0 done!
Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨
Here's your pull request refactoring your most popular Python repo.
If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run: