Skip to content

Instantly share code, notes, and snippets.

View MattKleinsmith's full-sized avatar

Matt Kleinsmith MattKleinsmith

View GitHub Profile
@MattKleinsmith
MattKleinsmith / get_train_valid_loader.py
Last active January 30, 2023 06:40 — forked from kevinzakka/data_loader.py
Train, Validation and Test Split for torchvision MNIST Dataset
# https://gist.github.com/kevinzakka/d33bf8d6c7f06a9d8c76d97a7879f5cb#file-data_loader-py
# This is an example for the MNIST dataset (formerly CIFAR-10).
# There's a function for creating a train and validation iterator.
# There's also a function for creating a test iterator.
# Inspired by https://discuss.pytorch.org/t/feedback-on-pytorch-for-kaggle-competitions/2252/4
# Adapted for MNIST by github.com/MatthewKleinsmith
import numpy as np
import torch