Skip to content

Commit c2b6655

Browse files
kazhangfacebook-github-bot
authored andcommitted
[fbsync] Update code to Python 3.7 compliance (#5125)
Summary: * Upgrade to py37 * Update Reviewed By: prabhat00155 Differential Revision: D33351109 fbshipit-source-id: 236eead0c67aabdb5cceea66a0875fcc7812f135
1 parent e6266e9 commit c2b6655

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

torchvision/datasets/_optical_flow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ def __init__(self, root, split="train", pass_name="clean", camera="left", transf
338338
directions = ("into_future", "into_past")
339339
for pass_name, camera, direction in itertools.product(passes, cameras, directions):
340340
image_dirs = sorted(glob(str(root / pass_name / split / "*/*")))
341-
image_dirs = sorted([Path(image_dir) / camera for image_dir in image_dirs])
341+
image_dirs = sorted(Path(image_dir) / camera for image_dir in image_dirs)
342342

343343
flow_dirs = sorted(glob(str(root / "optical_flow" / split / "*/*")))
344-
flow_dirs = sorted([Path(flow_dir) / direction / camera for flow_dir in flow_dirs])
344+
flow_dirs = sorted(Path(flow_dir) / direction / camera for flow_dir in flow_dirs)
345345

346346
if not image_dirs or not flow_dirs:
347347
raise FileNotFoundError(

torchvision/datasets/food101.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(
5151

5252
self._labels = []
5353
self._image_files = []
54-
with open(self._meta_folder / f"{split}.json", "r") as f:
54+
with open(self._meta_folder / f"{split}.json") as f:
5555
metadata = json.loads(f.read())
5656

5757
self.classes = sorted(metadata.keys())

torchvision/io/_video_opt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _validate_pts(pts_range: Tuple[int, int]) -> None:
7171
assert (
7272
pts_range[0] <= pts_range[1]
7373
), """Start pts should not be smaller than end pts, got
74-
start pts: {0:d} and end pts: {1:d}""".format(
74+
start pts: {:d} and end pts: {:d}""".format(
7575
pts_range[0],
7676
pts_range[1],
7777
)

torchvision/models/optical_flow/raft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class BottleneckBlock(nn.Module):
7474
"""Slightly modified BottleNeck block (extra relu and biases)"""
7575

7676
def __init__(self, in_channels, out_channels, *, norm_layer, stride=1):
77-
super(BottleneckBlock, self).__init__()
77+
super().__init__()
7878

7979
# See note in ResidualBlock for the reason behind bias=True
8080
self.convnormrelu1 = ConvNormActivation(

0 commit comments

Comments
 (0)