Hi Frederico!



 Federico_Ottomano:

Thanks, what about a standard fully connected neural network?


Focusing on your word “standard,” no, a fully-connected network will
not be able to accept a variable number of input features.
Let’s say you have an input batch of shape [nBatch, nFeatures]
and the first network layer is Linear (in_features, out_features).
If nFeatures != in_features pytorch will complain about a dimension
mismatch when your network tries to apply the weight matrix of your
first Linear to the input batch.
If you want to do something like this you will have to pad your input
feature vectors to all have the same length or similarly use “dummy”
values for “missing” features in the shorter feature vectors.
Bear in mind that feature[7] in one sample has to have the same
meaning as feature[7] in another sample – otherwise your network
won’t be able to “learn” what feature[7] means.  Therefore any
scheme you use to “pad” feature vectors to the same length has to
make sure that features with the same meaning end up in the same
location in the input vectors.
Best.
K. Frank