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 b78a29d commit 55a7c08
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions nanofed/data/mnist.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from pathlib import Path

import numpy as np
from numpy.typing import NDArray
from torch.utils.data import DataLoader, Subset
from torchvision import datasets, transforms

Expand Down Expand Up @@ -29,10 +28,9 @@ def load_mnist_data(

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

return DataLoader(
Expand Down

0 comments on commit 55a7c08

Please sign in to comment.