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

Method __init__

advanced_source/neural_style_tutorial.py:281–287  ·  view source on GitHub ↗
(self, mean, std)

Source from the content-addressed store, hash-verified

279# ``nn.Sequential``
280class Normalization(nn.Module):
281 def __init__(self, mean, std):
282 super(Normalization, self).__init__()
283 # .view the mean and std to make them [C x 1 x 1] so that they can
284 # directly work with image Tensor of shape [B x C x H x W].
285 # B is batch size. C is number of channels. H is height and W is width.
286 self.mean = torch.tensor(mean).view(-1, 1, 1)
287 self.std = torch.tensor(std).view(-1, 1, 1)
288
289 def forward(self, img):
290 # normalize ``img``

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected