simulation.utils.machine_learning.models.wasserstein_critic module¶
Reference¶
-
class
WassersteinCritic(input_nc: int, n_blocks: int = 3, norm: str = 'instance', ndf=32, height=256, width=256, use_dropout: bool = False, padding_type: str = 'reflect', conv_layers_in_block: int = 2, dilations: Optional[List[int]] = None)[source]¶ Bases:
torch.nn.modules.module.Module,simulation.utils.basics.init_options.InitOptions-
forward(input: 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
perform_optimization_step(generator: torch.nn.modules.module.Module, optimizer: torch.optim.optimizer.Optimizer, batch_critic: torch.Tensor, batch_generator: torch.Tensor, weight_clips: Optional[Tuple[float, float]] = None) → float[source]¶ Do one iteration to update the parameters.
- Parameters
generator – Generation network
optimizer – Optimizer for the critic’s weights
batch_critic – A batch of inputs for the critic
batch_generator – A batch of inputs for the generator
weight_clips – Optional weight bounds for the critic’s weights
- Returns
Current wasserstein distance estimated by critic.
-
training: bool¶
-