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:
|
||||
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:
|
||||
break
|
||||
|
||||
entity.grad_zero()
|
||||
for epochs in range(params.num_epochs):
|
||||
for mini_batch in to_mini_batch(batch, mini_batch_size):
|
||||
# Reset gradient
|
||||
entity.grad_zero()
|
||||
# Contrastive divergence learning: calculate gradients
|
||||
dwhv, dbv, dbh = cd_func(entity, mini_batch)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user