torch_frame.nn.encoder.FeatureEncoder
- class FeatureEncoder(*args, **kwargs)[source]
-
Base class for feature encoder that transforms input
torch_frame.TensorFrame
into(x, col_names)
, wherex
is the colum-wise PyTorch tensor of shape[batch_size, num_cols, channels]
andcol_names
is the names of the columns. This class contains learnable parameters and missing value handling.- abstract forward(tf: TensorFrame) tuple[torch.Tensor, list[str]] [source]
Encode
TensorFrame
object into a tuple(x, col_names)
.- Parameters:
tf (
torch_frame.TensorFrame
) – InputTensorFrame
object.- Returns:
- A tuple of an output column-wise
torch.Tensor
of shape[batch_size, num_cols, hidden_channels]
and a list of column names ofx
. The length needs to benum_cols
.
- Return type:
(torch.Tensor, List[str])