i think this is right! def backward(self, X, top_diff): output = self.forward(X) return (1.0 + np.square(output)) * top_diff beacuse (tanx)'=sec²x=1+tan²x