We should think about that because right now, in _score_tensor, we have to gather the logits after a forward and return it at the end of the method:
_, logits = self.feature_extractor.predict_tensor(inputs)
pred = logits
pred = self.op.convert_to_numpy(pred)
scores = -np.max(pred, axis=1)
logits = self.op.convert_to_numpy(logits)
return scores, logits
Also, in many baselines we need to perform a forward, e.g. in .fit, without using the logits.
Hence, automatically setting an attribute FeatureExtractor.logits when calling .predict could make the code more logical and encapsulated since we would be able not to bother with getting the logits or not, and only use them when needed.
We should think about that because right now, in
_score_tensor
, we have to gather the logits after a forward and return it at the end of the method:Also, in many baselines we need to perform a forward, e.g. in
.fit
, without using the logits. Hence, automatically setting an attributeFeatureExtractor.logits
when calling.predict
could make the code more logical and encapsulated since we would be able not to bother with getting the logits or not, and only use them when needed.