(self, target,)
| 171 | class 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) |