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

Method __init__

advanced_source/neural_style_tutorial.py:173–179  ·  view source on GitHub ↗
(self, target,)

Source from the content-addressed store, hash-verified

171class ContentLoss(nn.Module):
172
173 def __init__(self, target,):
174 super(ContentLoss, self).__init__()
175 # we 'detach' the target content from the tree used
176 # to dynamically compute the gradient: this is a stated value,
177 # not a variable. Otherwise the forward method of the criterion
178 # will throw an error.
179 self.target = target.detach()
180
181 def forward(self, input):
182 self.loss = F.mse_loss(input, self.target)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected