ncalab.models.applications.growing
Submodules
Classes
NCA Model class for "growing" tasks, in which a structure is grown from a single seed pixel. |
Package Contents
- class ncalab.models.applications.growing.GrowingNCAModel(device: torch.device, num_image_channels: int = 4, num_hidden_channels: int = 16, fire_rate: float = 0.5, hidden_size: int = 128, use_alive_mask: bool = False, lambda_hidden: float = 0.0, **kwargs)
Bases:
ncalab.models.basicNCA.AbstractNCAModelNCA Model class for “growing” tasks, in which a structure is grown from a single seed pixel.
This specialization of the BasicNCAModel has some interesting properties. For instance, it has no output channels, as the growing task directly manipulates the input image channels.
- Parameters:
[torch.device] (device) – Pytorch device descriptor.
[int] (hidden_size) – Number of channels reserved for input image. Defaults to 4.
[int] – Number of hidden channels (communication channels). Defaults to 16.
[float] (fire_rate) – Stochastic weight update. Defaults to 0.5.
[int] – Default number of nodes in hidden layer. Defaults to 128.
[bool] (use_alive_mask) – Whether to use alive masking. Defaults to False.
- loss(pred: ncalab.prediction.Prediction, label: torch.Tensor) Dict[str, torch.Tensor]
Implements a simple MSE loss between target and prediction.
- Parameters:
pred – Prediction
label – Target
- Returns [Tensor]:
MSE Loss
- make_seed(width: int, height: int) torch.Tensor
- grow(seed: torch.Tensor, steps: int = 100) List[numpy.ndarray]
Run the growth process and return the resulting output sequence.