Please help understand how to specify the base class method signature which can take at least one and potentially additional arguments.
I need to have a forward method which takes at least X, and additional arguments which may not required depending on a sub class.
class Layer: def forward(self, X, *args) -> float: The child class SoftmaxWithLogLoss forward has X and an additional argument T.
class SoftmaxWithLogLoss(Layer): def forward(self, X: np.ndarray, T: np.ndarray) -> float: <--- Signature does not match It causes a warning Signature of method 'SoftmaxWithLogLoss.forward()' does not match signature of base method in class 'Layer'.
Please explain what the cause is and how to fix.
https://stackoverflow.com/questions/66130676/signature-does-not-match-base-method-in-class February 10, 2021 at 11:51AM
没有评论:
发表评论