- added stack

- refactored
This commit is contained in:
2025-12-16 21:36:55 +01:00
parent f33df4b0e0
commit 71b723e4e9
4 changed files with 77 additions and 12 deletions
+20
View File
@@ -0,0 +1,20 @@
from layer import Layer
from stack import Stack, StackType, StackException
from params import RbmParams
if __name__ == "__main__":
params = RbmParams()
stack = Stack(StackType.Deep, "Stack")
dims = [(2, 3), (3, 4), (4, 5)]
for n, dim in enumerate(dims):
layer = Layer(f"Layer-{n}", dim, params)
stack.layer_add(layer)
stack.init(std=0.1)
stack.state_save()
try:
stack.layer_add(Layer(f"Layer-{0}", (9,9), params))
except StackException as e:
print(f"Exception raised: [{e}] -> success!")