Commit 3ced0fb3 authored by Elif Ceylan's avatar Elif Ceylan
Browse files

GROUPWORK_create net.py to generate network

parent 590139d8
# Internal
import modules as n
## Generic class to build a network with the list of modules
class Network():
def __init__(self, mods, input_size, output_size, hidden) -> None:
self.mods = mods
# forward
def forward(self, train_input):
x = n.Sequential(self.mods).forward(train_input)
return x
# backward
def backward(self, g_loss):
y = n.Sequential(self.mods).backward(g_loss)
return y
#get params
def param(self):
return n.Sequential(self.mods).param()
# update params
def update_params(self, lr):
n.Sequential(self.mods).update_params(lr)
# zero grad
def zero_grad(self):
n.Sequential(self.mods).zero_grad()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment