human
I am working on the file "DL0110EN/4.4.1mist2layer.ipynb".
The first task is:
define the class with the Tanh activation function
Can you write Python program for it?
 Write me a the Python program you requested?
assistant
#Here is the Python program you requested.

class NetTanh(nn.Module):
    def __init__(self,D_in,H1,H2,D_out):
        super(NetTanh,self).__init__()
        self.linear1=nn.Linear(D_in,H1)
        self.linear2=nn.Linear(H1,H2)
        self.linear3=nn.Linear(H2,D_out)
        
    def forward(self,x):
        x=torch.tanh(self.linear1(x))
        x=torch.tanh(self.linear2(x))
        x=self.linear3(x)
        return x