nntoolbox.vision.losses.style module¶
-
class
nntoolbox.vision.losses.style.
FeatureLoss
(model, layers, base_loss=<class 'torch.nn.modules.loss.MSELoss'>)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(output, target)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training
: bool¶
-
-
class
nntoolbox.vision.losses.style.
INStatisticsMatchingStyleLoss
(model, layers, base_loss=<class 'torch.nn.modules.loss.MSELoss'>)[source]¶ Bases:
nntoolbox.vision.losses.style.FeatureLoss
As suggested by https://arxiv.org/pdf/1703.06868.pdf
-
training
: bool¶
-
-
class
nntoolbox.vision.losses.style.
StyleLoss
(model, layers, base_loss=<class 'torch.nn.modules.loss.MSELoss'>)[source]¶ Bases:
nntoolbox.vision.losses.style.FeatureLoss
-
training
: bool¶
-
-
class
nntoolbox.vision.losses.style.
TotalVariationLoss
(base_loss=<class 'torch.nn.modules.loss.L1Loss'>)[source]¶ Bases:
torch.nn.modules.module.Module
Based on https://github.com/tensorflow/tensorflow/blob/r1.13/tensorflow/python/ops/image_ops_impl.py
-
forward
(input: torch.Tensor) → torch.Tensor[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training
: bool¶
-