train: swapped epochs and mini-batch loop
This commit is contained in:
+4
-3
@@ -214,12 +214,13 @@ def train(entity: Entity, batch: Mat, status: Status):
|
|||||||
if entity.type == Entity.Type.BG_RBM:
|
if entity.type == Entity.Type.BG_RBM:
|
||||||
cd_func = cd_binary_gaussian
|
cd_func = cd_binary_gaussian
|
||||||
|
|
||||||
for mini_batch in to_mini_batch(batch, mini_batch_size):
|
for epochs in range(params.num_epochs):
|
||||||
if not keep_running:
|
if not keep_running:
|
||||||
break
|
break
|
||||||
|
|
||||||
entity.grad_zero()
|
for mini_batch in to_mini_batch(batch, mini_batch_size):
|
||||||
for epochs in range(params.num_epochs):
|
# Reset gradient
|
||||||
|
entity.grad_zero()
|
||||||
# Contrastive divergence learning: calculate gradients
|
# Contrastive divergence learning: calculate gradients
|
||||||
dwhv, dbv, dbh = cd_func(entity, mini_batch)
|
dwhv, dbv, dbh = cd_func(entity, mini_batch)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user