MCPcopy Create free account
hub / github.com/pytorch/examples / __init__

Method __init__

siamese_network/main.py:81–95  ·  view source on GitHub ↗
(self, root, train, download=False)

Source from the content-addressed store, hash-verified

79
80class 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 """

Callers 1

__init__Method · 0.45

Calls 1

group_examplesMethod · 0.95

Tested by

no test coverage detected