Open
Conversation
| def deconv(c_in, c_out, k_size, stride=2, pad=1, bn=True): | ||
| layers = [] | ||
| layers.append(nn.ConvTranspose2d(c_in, c_out, k_size, stride, pad)) | ||
| layers = [nn.ConvTranspose2d(c_in, c_out, k_size, stride, pad)] |
Author
There was a problem hiding this comment.
Function deconv refactored with the following changes:
- Merge append into list declaration (
merge-list-append)
Comment on lines
-14
to
+13
| layers = [] | ||
| layers.append(nn.Conv2d(c_in, c_out, k_size, stride, pad)) | ||
| layers = [nn.Conv2d(c_in, c_out, k_size, stride, pad)] |
Author
There was a problem hiding this comment.
Function conv refactored with the following changes:
- Merge append into list declaration (
merge-list-append)
| p = p / np.sum(p) | ||
| c = np.random.choice(vocab_size, 1, p=p)[0] | ||
| return c | ||
| return np.random.choice(vocab_size, 1, p=p)[0] |
Author
There was a problem hiding this comment.
Function pick_top_n refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
Comment on lines
-23
to
+22
| samples = [c for c in prime] | ||
| samples = list(prime) |
Author
There was a problem hiding this comment.
Function sample refactored with the following changes:
- Replace identity comprehension with call to collection constructor (
identity-comprehension) - Replace unused for index with underscore (
for-index-underscore)
Comment on lines
-73
to
+82
| print('Epoch: {} '.format(e + 1), 'Loss: {:.4f} '.format(batch_loss), | ||
| '{:.4f} sec/batch'.format((end - start))) | ||
| print( | ||
| f'Epoch: {e + 1} ', | ||
| 'Loss: {:.4f} '.format(batch_loss), | ||
| '{:.4f} sec/batch'.format((end - start)), | ||
| ) | ||
|
|
||
| if (counter % save_every_n == 0): | ||
| saver.save(sess, "saves/{}.ckpt".format(counter)) | ||
| saver.save(sess, f"saves/{counter}.ckpt") | ||
|
|
||
| saver.save(sess, "saves/{}.ckpt".format(counter)) | ||
| saver.save(sess, f"saves/{counter}.ckpt") |
Author
There was a problem hiding this comment.
Function train refactored with the following changes:
- Replace call to format with f-string [×3] (
use-fstring-for-formatting)
Comment on lines
-52
to
+54
| layers = [] | ||
| layers.append( | ||
| block(self.in_channels, out_channels, stride, downsample)) | ||
| layers = [block(self.in_channels, out_channels, stride, downsample)] | ||
| self.in_channels = out_channels | ||
| for i in range(1, blocks): | ||
| layers.append(block(out_channels, out_channels)) | ||
| layers.extend(block(out_channels, out_channels) for _ in range(1, blocks)) |
Author
There was a problem hiding this comment.
Function ResNet.make_layer refactored with the following changes:
- Merge append into list declaration (
merge-list-append) - Replace unused for index with underscore (
for-index-underscore) - Replace a for append loop with list extend (
for-append-to-extend)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branch
masterrefactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
masterbranch, then run:Help us improve this pull request!