SymSwin3D#

vision_architectures.nets.symswin_3d.populate_and_validate_config(config)[source]#
Return type:

dict

vision_architectures.nets.symswin_3d.get_coords_grid(grid_size)[source]#
class vision_architectures.nets.symswin_3d.SymSwin3DMHSA(dim, num_heads, window_size, use_relative_position_bias, attn_drop_prob=0.0, proj_drop_prob=0.0)[source]#

Bases: Module

__init__(dim, num_heads, window_size, use_relative_position_bias, attn_drop_prob=0.0, proj_drop_prob=0.0)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

calculate_relative_position_bias()[source]#
forward(hidden_states)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class vision_architectures.nets.symswin_3d.SymSwin3DLayerMLP(dim, mlp_ratio, dropout_prob=0.0)[source]#

Bases: Module

__init__(dim, mlp_ratio, dropout_prob=0.0)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(hidden_states)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class vision_architectures.nets.symswin_3d.SymSwin3DLayer(dim, num_heads, mlp_ratio, layer_norm_eps, window_size, use_relative_position_bias, attn_drop_prob=0.0, proj_drop_prob=0.0, mlp_drop_prob=0.0)[source]#

Bases: Module

__init__(dim, num_heads, mlp_ratio, layer_norm_eps, window_size, use_relative_position_bias, attn_drop_prob=0.0, proj_drop_prob=0.0, mlp_drop_prob=0.0)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(hidden_states)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

vision_architectures.nets.symswin_3d.symmetry_attention_rearrange_forward(hidden_states)[source]#
vision_architectures.nets.symswin_3d.symmetry_attention_rearrange_backward(hidden_states)[source]#
class vision_architectures.nets.symswin_3d.SymSwin3DBlock(stage_config)[source]#

Bases: Module

__init__(stage_config)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(hidden_states)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class vision_architectures.nets.symswin_3d.SymSwin3DPatchMerging(merge_window_size, in_dim, out_dim)[source]#

Bases: Module

__init__(merge_window_size, in_dim, out_dim)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(hidden_states)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class vision_architectures.nets.symswin_3d.SymSwin3DStage(stage_config)[source]#

Bases: Module

__init__(stage_config)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(hidden_states)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class vision_architectures.nets.symswin_3d.SymSwin3DEncoder(*args, **kwargs)[source]#

Bases: Module, PyTorchModelHubMixin

__init__(config)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(hidden_states)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class vision_architectures.nets.symswin_3d.SymSwin3DPatchEmbeddings(config)[source]#

Bases: Module

__init__(config)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(pixel_values)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

vision_architectures.nets.symswin_3d.get_3d_position_embeddings(embedding_size, grid_size, patch_size=(1, 1, 1))[source]#
vision_architectures.nets.symswin_3d.embed_spacings_in_position_embeddings(embeddings, spacings)[source]#
class vision_architectures.nets.symswin_3d.SymSwin3DEmbeddings(config)[source]#

Bases: Module

__init__(config)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(pixel_values, spacings=None, mask_patches=None, mask_token=None)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class vision_architectures.nets.symswin_3d.SymSwin3DModel(*args, **kwargs)[source]#

Bases: Module, PyTorchModelHubMixin

__init__(config)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(pixel_values, spacings=None, mask_patches=None, mask_token=None)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class vision_architectures.nets.symswin_3d.SymSwin3DReconstructionDecoder(config)[source]#

Bases: Module

__init__(config)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(encodings)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class vision_architectures.nets.symswin_3d.SymSwin3DMIM(symswin_config, decoder_config, mim_config)[source]#

Bases: Module

__init__(symswin_config, decoder_config, mim_config)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

mask_image(pixel_values)[source]#
class vision_architectures.nets.symswin_3d.SymSwin3DSimMIM(*args, **kwargs)[source]#

Bases: SymSwin3DMIM, PyTorchModelHubMixin

__init__(symswin_config, decoder_config, mim_config)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

static loss_fn(pred, target, reduction='mean')[source]#
forward(pixel_values, spacings=None)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class vision_architectures.nets.symswin_3d.SymSwin3DVAEMIM(*args, **kwargs)[source]#

Bases: SymSwin3DMIM, PyTorchModelHubMixin

__init__(symswin_config, decoder_config, mim_config)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

get_beta()[source]#
reparameterize(mu, logvar)[source]#
static reconstruction_loss_fn(pred, target, loss_type='l2', reduction='mean')[source]#
static kl_divergence_loss_fn(mu, logvar)[source]#
forward(pixel_values, spacings=None, reconstruction_loss_type='l2')[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.