added model

This commit is contained in:
2025-12-21 16:39:53 +01:00
parent 7668c73ea4
commit 22d189cf2f
4 changed files with 116 additions and 17 deletions
+6 -3
View File
@@ -2,10 +2,10 @@ from .state import RbmState
from .matrix import prob, Mat
class EntityParams:
def __init__(self):
def __init__(self, do_gaussian_visible: bool = False, do_gaussian_hidden: bool = False):
# Entity parameters
self.do_gaussian_visible = False
self.do_gaussian_hidden = False
self.do_gaussian_visible = do_gaussian_visible
self.do_gaussian_hidden = do_gaussian_hidden
@classmethod
def from_dict(cls, params: dict):
@@ -24,6 +24,9 @@ class Entity:
self.state = RbmState.from_layer_params(shape)
self.grad = RbmState.from_layer_params(shape)
def __call__(self, x: Mat):
return self.forward(x)
def grad_zero(self):
self.grad = RbmState.from_layer_params(self.shape)