(self, root, train, download=False)
| 79 | |
| 80 | class APP_MATCHER(Dataset): |
| 81 | def __init__(self, root, train, download=False): |
| 82 | super(APP_MATCHER, self).__init__() |
| 83 | |
| 84 | # get MNIST dataset |
| 85 | self.dataset = datasets.MNIST(root, train=train, download=download) |
| 86 | |
| 87 | # as `self.dataset.data`'s shape is (Nx28x28), where N is the number of |
| 88 | # examples in MNIST dataset, a single example has the dimensions of |
| 89 | # (28x28) for (WxH), where W and H are the width and the height of the image. |
| 90 | # However, every example should have (CxWxH) dimensions where C is the number |
| 91 | # of channels to be passed to the network. As MNIST contains gray-scale images, |
| 92 | # we add an additional dimension to corresponds to the number of channels. |
| 93 | self.data = self.dataset.data.unsqueeze(1).clone() |
| 94 | |
| 95 | self.group_examples() |
| 96 | |
| 97 | def group_examples(self): |
| 98 | """ |
no test coverage detected