Last active
March 6, 2020 19:36
-
-
Save aiwithshekhar/56276e3a181b9faf9de2c4e7540f36de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Conv_Module(): | |
def __init__(self, img, ker, b, pad=1, stride=1): #initialization | |
self.img_b, self.img_d, self.img_h, self.img_w=img.shape | |
self.ker_b, self.ker_d, self.ker_h, self.ker_w=ker.shape | |
self.b, self.pad, self.stride, self.img, self.ker=b, pad, stride, img, ker | |
def __call__(self): | |
self.out=self.forward(self.img, self.ker) #forward method is called with images, kernel as input | |
return self.out | |
def forward(self): raise Exception('Not Implemented') #default raises not implemented error. | |
def backward(self): return self.bwd(self.out) #output from the forward method gets passed here as the input. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment