mnists/mnists/exceptions.py

19 lines
638 B
Python
Raw Normal View History

class IntegrityError(Exception):
def __init__(self, file, expected_hash, computed_hash):
self.file = file
self.expected_hash = expected_hash
self.computed_hash = computed_hash
def __str__(self):
2018-03-24 03:46:57 -07:00
return """Failed to validate dataset: {self.file}
Hash mismatch: {self.computed_hash} should be {self.expected_hash}
2018-03-24 03:46:57 -07:00
Please check your local file for tampering or corruption.""".format(self=self)
class UnknownDatasetError(Exception):
def __init__(self, dataset):
self.dataset = dataset
def __str__(self):
2018-03-24 03:46:57 -07:00
return "Unknown mnist-like dataset: {self.dataset}".format(self=self)