torchGB.layers.gnet package
Submodules
torchGB.layers.gnet.attn_gnet module
torchGB.layers.gnet.attn_gnet_fast module
torchGB.layers.gnet.conv_gnet module
torchGB.layers.gnet.conv_gnet_fast module
torchGB.layers.gnet.linear_gnet module
torchGB.layers.gnet.linear_gnet_fast module
torchGB.layers.gnet.model module
- class torchGB.layers.gnet.model.FastGenomicBottleNet(num_tiles: int, sizes: ~typing.Sequence[int], output_scale: ~torch.Tensor, activation_fn: ~torch.nn.modules.module.Module = <class 'torch.nn.modules.activation.ReLU'>)[source]
Bases:
GenomicBottleNet_summary_
TODO: generalize the implementation? TODO: use this implementation for fast computation of a set of adjacent tiles
- Parameters:
nn (_type_) – _description_
- Returns:
_description_
- Return type:
_type_
- forward(x: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchGB.layers.gnet.model.FastStochasticGenomicBottleNet(num_tiles: int, sizes: ~typing.Sequence[int], output_scale: ~torch.Tensor, activation_fn: ~torch.nn.modules.module.Module = <class 'torch.nn.modules.activation.ReLU'>)[source]
Bases:
FastGenomicBottleNet_summary_
TODO: generalize the implementation? TODO: use this implementation for fast computation of a set of adjacent tiles
- Parameters:
nn (_type_) – _description_
- Returns:
_description_
- Return type:
_type_
- forward(x: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchGB.layers.gnet.model.GenomicBottleNet(sizes: ~typing.Sequence[int], output_scale: float, activation_fn: ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <class 'torch.nn.modules.activation.ReLU'>)[source]
Bases:
ModuleImproved version of the variable-length g-net that uses a for-loop for initialization.
- Parameters:
layers (nn.ModuleList) – ModuleList that contains all differentiable layers of the g-net.
sizes (Sequence[int]) – List of sizes for the g-net layers.
output_scale (float) – Scaling factor for the output of the g-net.
activation_fn (Optional[Callable[[Tensor], Tensor]]) – Activation function for the hidden layers. Default is ReLU.
- Returns:
Prediction of the new weight.
- Return type:
Tensor
- forward(x: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- model: Sequential
- class torchGB.layers.gnet.model.Reshape(*shape)[source]
Bases:
Module- forward(x: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchGB.layers.gnet.model.StochasticGenomicBottleNet(sizes: ~typing.Sequence[int], output_scale: ~torch.Tensor, activation_fn: ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <class 'torch.nn.modules.activation.ReLU'>)[source]
Bases:
GenomicBottleNetImproved version of the variable-length g-net that uses a for-loop for initialization.
- Parameters:
layers (nn.ModuleList) – ModuleList that contains all differentiable layers of the g-net.
sizes (Sequence[int]) – List of sizes for the g-net layers.
output_scale (float) – Scaling factor for the output of the g-net.
activation_fn (Optional[Callable[[Tensor], Tensor]]) – Activation function for the hidden layers. Default is ReLU.
- Returns:
Prediction of the new weight.
- Return type:
Tensor
- forward(x: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- model: Sequential
torchGB.layers.gnet.pinv_fc_layer module
- class torchGB.layers.gnet.pinv_fc_layer.PseudoInverseLinear(in_features: int, out_features: int, bias: bool = True)[source]
Bases:
Module- extra_repr() str[source]
Set the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.