The current implementation of FeatureExtractor behaves as if it dynamically changes the shape of tensor at runtime depending on the type of data being input. This behavior seems intuitively quite non-trivial, but is there a clear reason why it was designed this way? It seems to me that the information about what type the input is and whether the input data has batch dimension should in principle be orthogonal concepts and should therefore be controlled separately by nature.
|
if not isinstance(x, torch.Tensor): |
|
xt = torch.tensor(x[np.newaxis], device=self.__device) |