Unverified Commit c0cd903d authored by Francisco Massa's avatar Francisco Massa Committed by GitHub
Browse files

Add deprecation warning in MNIST train[test]_labels[data] (#742)

parent 680c7459
from __future__ import print_function from __future__ import print_function
import warnings
import torch.utils.data as data import torch.utils.data as data
from PIL import Image from PIL import Image
import os import os
...@@ -37,6 +38,26 @@ class MNIST(data.Dataset): ...@@ -37,6 +38,26 @@ class MNIST(data.Dataset):
classes = ['0 - zero', '1 - one', '2 - two', '3 - three', '4 - four', classes = ['0 - zero', '1 - one', '2 - two', '3 - three', '4 - four',
'5 - five', '6 - six', '7 - seven', '8 - eight', '9 - nine'] '5 - five', '6 - six', '7 - seven', '8 - eight', '9 - nine']
@property
def train_labels(self):
warnings.warn("train_labels has been renamed targets")
return self.targets
@property
def test_labels(self):
warnings.warn("test_labels has been renamed targets")
return self.targets
@property
def train_data(self):
warnings.warn("train_data has been renamed data")
return self.data
@property
def test_data(self):
warnings.warn("test_data has been renamed data")
return self.data
def __init__(self, root, train=True, transform=None, target_transform=None, download=False): def __init__(self, root, train=True, transform=None, target_transform=None, download=False):
self.root = os.path.expanduser(root) self.root = os.path.expanduser(root)
self.transform = transform self.transform = transform
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment