torchtable.model module

Module contents

class torchtable.model.BatchHandlerModel(embs: List[torch.nn.modules.module.Module], batch_cat_field_getters: List[Callable[Dict, None._VariableFunctions.tensor]], batch_num_field_getters: Callable[Dict, None._VariableFunctions.tensor])

Bases: torch.nn.modules.module.Module

A model that takes a batch as input and converts it into a single 2-d tensor. Categorical fields are all embedded and the embeddings are all concatenated along with the numerical fields.

static field_to_embedding(fld: torchtable.field.core.CategoricalField) → torch.nn.modules.module.Module
forward(batch)

Defines 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.

classmethod from_dataset(dataset: torchtable.dataset.core.TabularDataset) → DefaultModel
out_dim()