Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions torchvision/transforms/autoaugment.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ def forward(self, img: Tensor) -> Tensor:

transform_id, probs, signs = self.get_params(len(self.policies))

op_meta = self._augmentation_space(10, F.get_image_size(img))
for i, (op_name, p, magnitude_id) in enumerate(self.policies[transform_id]):
if probs[i] <= p:
op_meta = self._augmentation_space(10, F.get_image_size(img))
magnitudes, signed = op_meta[op_name]
magnitude = float(magnitudes[magnitude_id].item()) if magnitude_id is not None else 0.0
if signed and signs[i] == 0:
Expand Down Expand Up @@ -350,8 +350,8 @@ def forward(self, img: Tensor) -> Tensor:
elif fill is not None:
fill = [float(f) for f in fill]

op_meta = self._augmentation_space(self.num_magnitude_bins, F.get_image_size(img))
for _ in range(self.num_ops):
op_meta = self._augmentation_space(self.num_magnitude_bins, F.get_image_size(img))
op_index = int(torch.randint(len(op_meta), (1,)).item())
op_name = list(op_meta.keys())[op_index]
magnitudes, signed = op_meta[op_name]
Expand Down