Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d13a4c6

Browse files
committed
enable tensor index.
1 parent 5859c0e commit d13a4c6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

beginner_source/data_loading_tutorial.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ def __len__(self):
136136
return len(self.landmarks_frame)
137137

138138
def __getitem__(self, idx):
139+
if torch.is_tensor(idx):
140+
idx = idx.tolist()
141+
139142
img_name = os.path.join(self.root_dir,
140143
self.landmarks_frame.iloc[idx, 0])
141144
image = io.imread(img_name)

0 commit comments

Comments
 (0)