scimilarity.nn_models#

This file contains the neural network architectures. These are all you need for inference.

class scimilarity.nn_models.Decoder(n_genes, latent_dim=128, hidden_dim=[1024, 1024], dropout=0.5, residual=False)[source]#

Bases: Module

A class that encapsulates the decoder.

Parameters:
  • n_genes (int) –

  • latent_dim (int) –

  • hidden_dim (List[int]) –

  • dropout (float) –

  • residual (bool) –

forward(x)[source]#

Forward.

Parameters:

x (torch.Tensor) – Input tensor corresponding to input layer.

Returns:

Output tensor corresponding to output layer.

Return type:

torch.Tensor

load_state(filename, use_gpu=False)[source]#

Load model state.

Parameters:
  • filename (str) – Filename containing the model state.

  • use_gpu (bool, default: False) – Boolean indicating whether or not to use GPUs.

save_state(filename)[source]#

Save model state.

Parameters:

filename (str) – Filename to save the model state.

class scimilarity.nn_models.Encoder(n_genes, latent_dim=128, hidden_dim=[1024, 1024], dropout=0.5, input_dropout=0.4, residual=False)[source]#

Bases: Module

A class that encapsulates the encoder.

Parameters:
  • n_genes (int) –

  • latent_dim (int) –

  • hidden_dim (List[int]) –

  • dropout (float) –

  • input_dropout (float) –

  • residual (bool) –

forward(x)[source]#

Forward.

Parameters:

x (torch.Tensor) – Input tensor corresponding to input layer.

Returns:

Output tensor corresponding to output layer.

Return type:

torch.Tensor

load_state(filename, use_gpu=False)[source]#

Load model state.

Parameters:
  • filename (str) – Filename containing the model state.

  • use_gpu (bool, default: False) – Boolean indicating whether or not to use GPUs.

save_state(filename)[source]#

Save model state.

Parameters:

filename (str) – Filename to save the model state.