MCPcopy Create free account
hub / github.com/pytorch/tutorials / __call__

Method __call__

beginner_source/data_loading_tutorial.py:260–274  ·  view source on GitHub ↗
(self, sample)

Source from the content-addressed store, hash-verified

258 self.output_size = output_size
259
260 def __call__(self, sample):
261 image, landmarks = sample['image'], sample['landmarks']
262
263 h, w = image.shape[:2]
264 new_h, new_w = self.output_size
265
266 top = np.random.randint(0, h - new_h + 1)
267 left = np.random.randint(0, w - new_w + 1)
268
269 image = image[top: top + new_h,
270 left: left + new_w]
271
272 landmarks = landmarks - [left, top]
273
274 return {'image': image, 'landmarks': landmarks}
275
276
277class ToTensor(object):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected