ncalab.models.applications.growing.growingNCA ============================================= .. py:module:: ncalab.models.applications.growing.growingNCA Classes ------- .. autoapisummary:: ncalab.models.applications.growing.growingNCA.GrowingNCAModel Module 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, lambda_hidden: float = 0.0, **kwargs) Bases: :py:obj:`ncalab.models.basicNCA.AbstractNCAModel` 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:attribute:: lambda_hidden :value: 0.0 .. 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:: 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.