hyrax.models.hyrax_autoencoder#

Attributes#

Classes#

HyraxAutoencoder

This autoencoder is designed to work with a wide range of image datasets to allow testing.

Module Contents#

logger[source]#
class HyraxAutoencoder(config, data_sample=None)[source]#

Bases: torch.nn.Module

This autoencoder is designed to work with a wide range of image datasets to allow testing.

This example model is taken from this autoenocoder tutorial

The train function has been converted into train_step for use with pytorch-ignite.

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

config[source]#
c_hid[source]#
latent_dim[source]#
conv_end_w[source]#
conv_end_h[source]#
conv2d_multi_layer(input_size, num_applications, **kwargs) int[source]#
conv2d_output_size(input_size, kernel_size, padding=0, stride=1, dilation=1) int[source]#
_init_encoder()[source]#
_eval_encoder(x)[source]#
_init_decoder()[source]#
_eval_decoder(x)[source]#
forward(batch)[source]#
train_step(batch)[source]#

This function contains the logic for a single training step. i.e. the contents of the inner loop of a ML training process.

Parameters:

batch (tuple) – A tuple containing the inputs and labels for the current batch.

Returns:

Current loss value – Dictionary containing the loss value for the current batch.

Return type:

dict

static to_tensor(data_dict) tuple[source]#

This function converts structured data to the input tensor we need to run

Parameters:

data_dict (dict) – The dictionary returned from our data source

_optimizer()[source]#