Skip to content
Snippets Groups Projects
Commit d3414387 authored by Falguni Ghosh's avatar Falguni Ghosh
Browse files

Upload New File

parent 9ed354e0
No related branches found
No related tags found
No related merge requests found
import numpy as np
from .Base import BaseLayer
class TanH(BaseLayer):
def __init__(self):
super().__init__()
self.activation = None
self.error_tensor = None
def forward(self,input_tensor):
self.activation = np.tanh(input_tensor)
return self.activation
def backward(self,error_tensor):
self.error_tensor = error_tensor * (1-self.activation**2)
return self.error_tensor
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment