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

Upload New File

parent 812878e6
Branches
No related tags found
No related merge requests found
import numpy as np
from exercise1_material.src_to_implement.Layers.Base import BaseLayer
class ReLU(BaseLayer):
def __init__(self):
super().__init__()
self.buffered_input = None
def forward(self, input_tensor):
self.buffered_input = input_tensor
input_tensor[input_tensor < 0] = 0
return input_tensor
def backward(self, error_tensor):
error_tensor[self.buffered_input <= 0] = 0
return error_tensor
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment