Skip to content

Commit

Permalink
Fix formats
Browse files Browse the repository at this point in the history
  • Loading branch information
datumbox committed Dec 8, 2020
1 parent 7a84b27 commit bbe6590
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/test_transforms_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ def test_autoaugment(self):
with get_tmp_dir() as tmp_dir:
s_transform.save(os.path.join(tmp_dir, "t_autoaugment.pt"))


@unittest.skipIf(not torch.cuda.is_available(), reason="Skip if no CUDA device")
class CUDATester(Tester):

Expand Down
4 changes: 2 additions & 2 deletions torchvision/transforms/autoaugment.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ def forward(self, img: Tensor):
for i, (op_name, p, magnitude_id) in enumerate(self.policies[policy_id]):
if probs[i] <= p:
magnitudes, signed = self._get_op_meta(op_name)
magnitude = float(magnitudes[magnitude_id].item()) if magnitudes is not None and \
magnitude_id is not None else 0.0
magnitude = float(magnitudes[magnitude_id].item()) \
if magnitudes is not None and magnitude_id is not None else 0.0
if signed is not None and signed and signs[i] == 0:
magnitude *= -1.0

Expand Down

0 comments on commit bbe6590

Please sign in to comment.