From 2b6dc4d487203d4fb0a29aca924e104884b4e282 Mon Sep 17 00:00:00 2001 From: Akihiro Nitta Date: Mon, 18 Jan 2021 14:44:51 +0900 Subject: [PATCH] yapf --- pl_bolts/models/detection/__init__.py | 2 +- .../detection/faster_rcnn/faster_rcnn_module.py | 8 ++------ pl_bolts/models/mnist_module.py | 4 +--- pl_bolts/models/rl/common/gym_wrappers.py | 16 ++++------------ 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/pl_bolts/models/detection/__init__.py b/pl_bolts/models/detection/__init__.py index 1d18b846b9..7e847792ec 100644 --- a/pl_bolts/models/detection/__init__.py +++ b/pl_bolts/models/detection/__init__.py @@ -1,5 +1,5 @@ from pl_bolts.models.detection.faster_rcnn import FasterRCNN # noqa: F401 __all__ = [ - "FasterRCNN" + "FasterRCNN", ] diff --git a/pl_bolts/models/detection/faster_rcnn/faster_rcnn_module.py b/pl_bolts/models/detection/faster_rcnn/faster_rcnn_module.py index 7a9cdcdc9d..8e32521cd4 100644 --- a/pl_bolts/models/detection/faster_rcnn/faster_rcnn_module.py +++ b/pl_bolts/models/detection/faster_rcnn/faster_rcnn_module.py @@ -20,9 +20,7 @@ def _evaluate_iou(target, pred): from model """ if not _TORCHVISION_AVAILABLE: # pragma: no cover - raise ModuleNotFoundError( - 'You want to use `torchvision` which is not installed yet.' - ) + raise ModuleNotFoundError('You want to use `torchvision` which is not installed yet.') if pred["boxes"].shape[0] == 0: # no box detected, 0 IOU @@ -71,9 +69,7 @@ def __init__( trainable_backbone_layers: number of trainable resnet layers starting from final block """ if not _TORCHVISION_AVAILABLE: # pragma: no cover - raise ModuleNotFoundError( - 'You want to use `torchvision` which is not installed yet.' - ) + raise ModuleNotFoundError('You want to use `torchvision` which is not installed yet.') super().__init__() diff --git a/pl_bolts/models/mnist_module.py b/pl_bolts/models/mnist_module.py index 2f6709ce7f..be6c4ee623 100644 --- a/pl_bolts/models/mnist_module.py +++ b/pl_bolts/models/mnist_module.py @@ -19,9 +19,7 @@ class LitMNIST(LightningModule): def __init__(self, hidden_dim=128, learning_rate=1e-3, batch_size=32, num_workers=4, data_dir='', **kwargs): if not _TORCHVISION_AVAILABLE: # pragma: no cover - raise ModuleNotFoundError( - 'You want to use `torchvision` which is not installed yet.' - ) + raise ModuleNotFoundError('You want to use `torchvision` which is not installed yet.') super().__init__() self.save_hyperparameters() diff --git a/pl_bolts/models/rl/common/gym_wrappers.py b/pl_bolts/models/rl/common/gym_wrappers.py index c573056b38..d14a736b9d 100644 --- a/pl_bolts/models/rl/common/gym_wrappers.py +++ b/pl_bolts/models/rl/common/gym_wrappers.py @@ -30,9 +30,7 @@ class ToTensor(Wrapper): def __init__(self, env=None): if not _GYM_AVAILABLE: # pragma: no cover - raise ModuleNotFoundError( - 'You want to use `gym` which is not installed yet.' - ) + raise ModuleNotFoundError('You want to use `gym` which is not installed yet.') super(ToTensor, self).__init__(env) @@ -51,9 +49,7 @@ class FireResetEnv(Wrapper): def __init__(self, env=None): if not _GYM_AVAILABLE: # pragma: no cover - raise ModuleNotFoundError( - 'You want to use `gym` which is not installed yet.' - ) + raise ModuleNotFoundError('You want to use `gym` which is not installed yet.') super(FireResetEnv, self).__init__(env) assert env.unwrapped.get_action_meanings()[1] == "FIRE" @@ -80,9 +76,7 @@ class MaxAndSkipEnv(Wrapper): def __init__(self, env=None, skip=4): if not _GYM_AVAILABLE: # pragma: no cover - raise ModuleNotFoundError( - 'You want to use `gym` which is not installed yet.' - ) + raise ModuleNotFoundError('You want to use `gym` which is not installed yet.') super(MaxAndSkipEnv, self).__init__(env) # most recent raw observations (for max pooling across time steps) @@ -202,9 +196,7 @@ class DataAugmentation(ObservationWrapper): def __init__(self, env=None): if not _GYM_AVAILABLE: # pragma: no cover - raise ModuleNotFoundError( - 'You want to use `gym` which is not installed yet.' - ) + raise ModuleNotFoundError('You want to use `gym` which is not installed yet.') super().__init__(env) self.observation_space = gym.spaces.Box(low=0, high=255, shape=(84, 84, 1), dtype=np.uint8)