KamitaniLab / bdpy

Python package for brain decoding analysis (BrainDecoderToolbox2 data format, machine learning analysis, functional MRI)
MIT License
33 stars 22 forks source link

Why FeatureExtractor implicitly add batch dimension for input other than torch.Tensor()? #69

Open ganow opened 1 year ago

ganow commented 1 year ago

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.

https://github.com/KamitaniLab/bdpy/blob/4e87ee15ec6991c040a85e297cde0507ee54b1b0/bdpy/dl/torch/torch.py#L78-L79