ncalab.models.applications.growing ================================== .. py:module:: ncalab.models.applications.growing Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/ncalab/models/applications/growing/growingNCA/index Classes ------- .. autoapisummary:: ncalab.models.applications.growing.GrowingNCAModel Package Contents ---------------- .. py:class:: 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, **kwargs) Bases: :py:obj:`ncalab.models.basicNCA.BasicNCAModel` NCA 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. :param device [torch.device]: Pytorch device descriptor. :param num_image_channels [int]: Number of channels reserved for input image. Defaults to 4. :param num_hidden_channels [int]: Number of hidden channels (communication channels). Defaults to 16. :param fire_rate [float]: Stochastic weight update. Defaults to 0.5. :param hidden_size [int]: Default number of nodes in hidden layer. Defaults to 128. :param use_alive_mask [bool]: Whether to use alive masking. Defaults to False. .. py:method:: loss(pred: ncalab.prediction.Prediction, label: torch.Tensor) -> Dict[str, torch.Tensor] Implements a simple MSE loss between target and prediction. :param pred: Prediction :param label: Target :returns [Tensor]: MSE Loss .. py:method:: validate(image: torch.Tensor, label: torch.Tensor, steps: Optional[int] = None) -> Optional[Tuple[Dict[str, float], ncalab.prediction.Prediction]] We typically don't validate during training of Growing NCA, because there is only a single sample in the training set. .. py:method:: make_seed(width: int, height: int) -> torch.Tensor .. py:method:: grow(seed: torch.Tensor, steps: int = 100) -> List[numpy.ndarray] Run the growth process and return the resulting output sequence. :param seed [torch.Tensor]: Seed image, can be generated through make_seed. :param steps [int]: Number of inference steps. Defaults to 100. :returns [List[np.ndarray]]: Sequence of output images.