How to handle data with different types (equivalent of `tf.feature_column`)

I have a dataset where features are of different types, such as float32 and str (categorical). I know that to represent str features, I should embed them first. In fact, each str feature can be considered as a sentence with specific number of vocabs and I need to define their index with torch.LongTensor. However, it’s not clear how to define the forward method. This seems overly complicated!

I’m basically looking for an equivalent method like tf.feature_column, tf.feature_column.categorical_column_with_vocabulary_list or tf.feature_column.categorical_column_with_hash_bucket.

1 Like