Skip to content
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 AgainstEntropy/NLOS-Track #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SourceryAI
Copy link

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 main branch, then run:

git fetch https://github.com/sourcery-ai-bot/NLOS-Track main
git merge --ff-only FETCH_HEAD
git reset HEAD^

assert model_name in ['PAC_Net', 'P_Net', 'C_Net', 'baseline']
assert model_name in {'PAC_Net', 'P_Net', 'C_Net', 'baseline'}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PAC_Cell.__init__ refactored with the following changes:

assert model_name in ['PAC_Net', 'P_Net', 'C_Net', 'baseline']
assert model_name in {'PAC_Net', 'P_Net', 'C_Net', 'baseline'}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PAC_Net_Base.__init__ refactored with the following changes:

hx = self.warmup_rnn(fx)[1] # (2, B, D)

return hx
return self.warmup_rnn(fx)[1]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function C_Net.warm_up refactored with the following changes:

This removes the following comments ( why? ):

# (2, B, D)

dist_cfgs['distributed'] = True if world_size > 1 else False
dist_cfgs['distributed'] = world_size > 1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function main refactored with the following changes:

Comment on lines -60 to -65
if phase == 'train':
if phase == 'test':
return full_dataset
elif phase == 'train':
train_size = int(len(full_dataset) * train_ratio)
val_size = len(full_dataset) - train_size
return random_split(full_dataset, [train_size, val_size])
elif phase == 'test':
return full_dataset
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function split_dataset refactored with the following changes:

  • Simplify conditional into switch-like form (switch)

for step in range(len_loader):
for _ in range(len_loader):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Trainer_tracking.train refactored with the following changes:

Comment on lines -485 to +490
logger.info(f'Performance on validation set at epoch: {epoch + 1}\n' + res_table.get_string())
logger.info(
f'Performance on validation set at epoch: {epoch + 1}\n{res_table.get_string()}'
)

return (self.val_metrics['x_loss'], self.val_metrics['v_loss']), \
(self.val_metrics['pcm'], self.val_metrics['area'], self.val_metrics['dtw'])
(self.val_metrics['pcm'], self.val_metrics['area'], self.val_metrics['dtw'])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Trainer_tracking.val refactored with the following changes:

Comment on lines -491 to +493
assert phase in ['train', 'val']
assert phase in {'train', 'val'}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Trainer_tracking.test_plot refactored with the following changes:

fig.colorbar(line, ax=ax, ticks=idxs[::int(len(idxs) / 10)], label='step')
fig.colorbar(line, ax=ax, ticks=idxs[::len(idxs) // 10], label='step')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function draw_route refactored with the following changes:

assert return_mode in ['plt_fig', 'fig_array', None]
assert return_mode in {'plt_fig', 'fig_array', None}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function draw_routes refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant