from .Base_layer import Base_layer
import numpy as np
class Tanh(Base_layer):
    def __init__ (self):
        self.out = None
    def forward(self, x):
        out = np.tanh(x)
        self.out = out
        return out
    def backward(self, dout):
        dx = dout * (1 - self.out**2)
        return dx