foscat.healpix_vit_skip#
Attributes#
Classes#
Base class for all neural network modules. |
|
Base class for all neural network modules. |
Module Contents#
- class foscat.healpix_vit_skip.MLP(d: int, hidden_mult: int = 4, drop: float = 0.0)[source]#
Bases:
torch.nn.ModuleBase class for all neural network modules.
Your models should also subclass this class.
Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:
import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self) -> None: super().__init__() self.conv1 = nn.Conv2d(1, 20, 5) self.conv2 = nn.Conv2d(20, 20, 5) def forward(self, x): x = F.relu(self.conv1(x)) return F.relu(self.conv2(x))
Submodules assigned in this way will be registered, and will also have their parameters converted when you call
to(), etc.Note
As per the example above, an
__init__()call to the parent class must be made before assignment on the child.- Variables:
training (bool) – Boolean represents whether this module is in training or evaluation mode.
- net#
- class foscat.healpix_vit_skip.HealpixViTSkip(*, in_nside: int, n_chan_in: int, level_dims: List[int], depth_token: int, num_heads_token: int, cell_ids: numpy.ndarray, task: Literal['regression', 'segmentation', 'global'] = 'regression', out_channels: int = 1, mlp_ratio_token: float = 4.0, KERNELSZ: int = 3, gauge_type: Literal['cosmo', 'phi'] = 'cosmo', G: int = 1, prefer_foscat_gpu: bool = True, dropout: float = 0.1, dtype: Literal['float32', 'float64'] = 'float32', pos_embed_per_level: bool = True)[source]#
Bases:
torch.nn.ModuleBase class for all neural network modules.
Your models should also subclass this class.
Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:
import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self) -> None: super().__init__() self.conv1 = nn.Conv2d(1, 20, 5) self.conv2 = nn.Conv2d(20, 20, 5) def forward(self, x): x = F.relu(self.conv1(x)) return F.relu(self.conv2(x))
Submodules assigned in this way will be registered, and will also have their parameters converted when you call
to(), etc.Note
As per the example above, an
__init__()call to the parent class must be made before assignment on the child.- Variables:
training (bool) – Boolean represents whether this module is in training or evaluation mode.
- in_nside#
- n_chan_in#
- level_dims#
- token_down#
- C_fine#
- embed_dim#
- depth_token#
- num_heads_token#
- mlp_ratio_token#
- task = 'regression'#
- out_channels = 1#
- KERNELSZ = 3#
- gauge_type = 'cosmo'#
- G = 1#
- prefer_foscat_gpu = True#
- dropout#
- dtype = 'float32'#
- pos_embed_per_level = True#
- cell_ids_fine#
- f#
- hconv_levels: List[foscat.SphericalStencil.SphericalStencil] = []#
- level_cell_ids: List[numpy.ndarray]#
- token_nside#
- token_cell_ids#
- hconv_token#
- hconv_head#
- nsides_levels#
- ntokens_levels#
- pe_w1#
- pe_w2#
- pe_bn1#
- pe_bn2#
- enc_w1#
- enc_w2#
- enc_bn1#
- enc_bn2#
- temporal_encoders#
- n_tokens#
- pos_token#
- encoder_token#
- dec_q#
- dec_k#
- dec_v#
- dec_attn#
- dec_mlp#
- level_pos#
- dec_refine_w1#
- dec_refine_w2#
- dec_refine_bn1#
- dec_refine_bn2#
- runtime_device#
- forward(x: torch.Tensor, runtime_ids: numpy.ndarray | None = None) torch.Tensor[source]#
- foscat.healpix_vit_skip.in_nside = 4#