fixed deep stack status update

This commit is contained in:
2025-12-18 12:31:32 +01:00
parent 5cbef6b09f
commit f6bccd3737
3 changed files with 12 additions and 8 deletions
+4 -4
View File
@@ -12,7 +12,7 @@ class StackDeep(Stack):
for index, layer in enumerate(self.layers):
if index == from_layer_id:
break
_batch = layer.v_to_ph(_batch)
_batch = layer.entity.v_to_ph(_batch)
return _batch
@@ -21,19 +21,19 @@ class StackDeep(Stack):
for index, layer in enumerate(self.layers):
print(f"Train layer {index}")
_batch = self.batch_from(batch, index)
layer.train(_batch, cd_func=cd_jens, status=status)
layer.entity.train(_batch, cd_func=cd_jens, status=status)
def pass_up(self, visible: np.ndarray, from_layer_id: int = 0):
h = np.matrix.copy(visible)
for layer in self.layers[from_layer_id:]:
h = layer.gibbs_v_to_h(h)
h = layer.entity.gibbs_v_to_h(h)
return h
def pass_down(self, hidden: np.ndarray, from_layer_id: int = 0):
v = np.matrix.copy(hidden)
for layer in list(reversed(self.layers))[from_layer_id:]:
v = layer.gibbs_h_to_v(v)
v = layer.entity.gibbs_h_to_v(v)
return v
def pass_down_up(self, visible: np.ndarray, from_layer_id: int = 0):