deepchem
deepchem copied to clipboard
Refactoring FCNet
🚀 Feature
File : deepchem/models/fcnet.py
Motivation
MultiTaskClassifier
and MultiTaskRegressor
have a subclass PyTorchImpl
which implements a torch.nn.Module
If we decouple this subclass from TorchModel wrapper as in #2963 , the class can be reused as PyTorch Linear Layer for other future use cases of deepchem
Additionally, we should move this file from
deepchem/models/
to deepchem/models/torch_models/
@peastman do you think refactoring is reasonable?
The code looks pretty specific to these models. Extracting it would make it more complicated (for example, it couldn't refer to variables in the surrounding scope anymore), and some parts of it (like uncertainty prediction) aren't relevant to other uses.
If you want to use one of these models as a building block for a larger model, I would use it directly. Something like this.
classifier = MultitaskClassifier(...)
...
outputs = classifier.model(input)