core.models.utils.basis#
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
Classes#
| Base class for all neural network modules. | |
| Base class for all neural network modules. | |
| Base class for all neural network modules. | |
| Base class for all neural network modules. | |
| Base class for all neural network modules. | |
| Base class for all neural network modules. | |
| Base class for all neural network modules. | 
Module Contents#
- class core.models.utils.basis.Sine(w0: float = 30.0)#
- Bases: - torch.nn.Module- Base 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. 
 - w0#
 - forward(x: torch.Tensor) torch.Tensor#
 
- class core.models.utils.basis.SIREN(layers: list[int], num_in_features: int, out_features: int, w0: float = 30.0, initializer: str | None = 'siren', c: float = 6)#
- Bases: - torch.nn.Module- Base 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. 
 - layers#
 - network#
 - forward(X: torch.Tensor) torch.Tensor#
 
- class core.models.utils.basis.SINESmearing(num_in_features: int, num_freqs: int = 40, use_cosine: bool = False)#
- Bases: - torch.nn.Module- Base 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. 
 - num_freqs#
 - out_dim: int#
 - use_cosine#
 - freq_filter#
 - forward(x: torch.Tensor) torch.Tensor#
 
- class core.models.utils.basis.GaussianSmearing(num_in_features: int, start: int = 0, end: int = 1, num_freqs: int = 50)#
- Bases: - torch.nn.Module- Base 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. 
 - num_freqs#
 - coeff: float#
 - offset#
 - forward(x: torch.Tensor) torch.Tensor#
 
- class core.models.utils.basis.FourierSmearing(num_in_features: int, num_freqs: int = 40, use_cosine: bool = False)#
- Bases: - torch.nn.Module- Base 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. 
 - num_freqs#
 - out_dim: int#
 - use_cosine#
 - freq_filter#
 - forward(x: torch.Tensor) torch.Tensor#
 
- class core.models.utils.basis.Basis(num_in_features: int, num_freqs: int = 50, basis_type: str = 'powersine', act: str = 'ssp', sph: SphericalSmearing | None = None)#
- Bases: - torch.nn.Module- Base 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. 
 - smearing: SINESmearing | FourierSmearing | GaussianSmearing | torch.nn.Sequential#
 - num_freqs#
 - basis_type#
 - forward(x: torch.Tensor, edge_attr_sph: torch.Tensor | None = None)#
 
- class core.models.utils.basis.SphericalSmearing(max_n: int = 10, option: str = 'all')#
- Bases: - torch.nn.Module- Base 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. 
 - m: numpy.typing.NDArray[numpy.int_]#
 - n: numpy.typing.NDArray[numpy.int_]#
 - max_n#
 - out_dim#
 - forward(xyz: torch.Tensor) torch.Tensor#