Skip to content

Commit

Permalink
fix: mypy issue
Browse files Browse the repository at this point in the history
  • Loading branch information
camille-004 committed Dec 8, 2024
1 parent 55a7c08 commit 284148c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nanofed/data/mnist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path
from typing import Sequence

import numpy as np
from torch.utils.data import DataLoader, Subset
Expand Down Expand Up @@ -28,9 +29,10 @@ def load_mnist_data(

if subset_fraction < 1.0:
num_samples = int(len(dataset) * subset_fraction)
subset_indices = np.random.choice(
indices_array = np.random.choice(
a=len(dataset), size=num_samples, replace=False
).tolist()
)
subset_indices: Sequence[int] = list(map(int, indices_array))
dataset = Subset(dataset, subset_indices)

return DataLoader(
Expand Down

0 comments on commit 284148c

Please sign in to comment.