Optimizer.train() shall ignore param.do_batch_sample
This commit is contained in:
+4
-6
@@ -145,17 +145,13 @@ class Optimizer:
|
|||||||
d_progress = 100.0 / self.params.num_epochs
|
d_progress = 100.0 / self.params.num_epochs
|
||||||
progress = 0
|
progress = 0
|
||||||
|
|
||||||
v_states = batch
|
|
||||||
if self.params.do_batch_sample:
|
|
||||||
v_states = sample(batch)
|
|
||||||
|
|
||||||
forward = None
|
|
||||||
for epochs in range(self.params.num_epochs):
|
for epochs in range(self.params.num_epochs):
|
||||||
forward = self.epoch(v_states)
|
self.epoch(batch)
|
||||||
|
|
||||||
# check if status update is needed
|
# check if status update is needed
|
||||||
if status.want_report(round(progress)):
|
if status.want_report(round(progress)):
|
||||||
# Calculate error
|
# Calculate error
|
||||||
|
forward = self.entity.forward(batch)
|
||||||
result = self.entity.reconstruct(forward)
|
result = self.entity.reconstruct(forward)
|
||||||
err_rms = rms_error_accu(batch - result)
|
err_rms = rms_error_accu(batch - result)
|
||||||
if not status.on_change({"progress": {"value": round(progress), "unit": "%"},
|
if not status.on_change({"progress": {"value": round(progress), "unit": "%"},
|
||||||
@@ -164,6 +160,7 @@ class Optimizer:
|
|||||||
|
|
||||||
progress += d_progress
|
progress += d_progress
|
||||||
|
|
||||||
|
forward = self.entity.forward(batch)
|
||||||
err_rms = rms_error_accu(batch - self.entity.reconstruct(forward))
|
err_rms = rms_error_accu(batch - self.entity.reconstruct(forward))
|
||||||
status.on_change({"progress": {"value": round(progress), "unit": "%"},
|
status.on_change({"progress": {"value": round(progress), "unit": "%"},
|
||||||
"err_rms": {"value": err_rms, "unit": ""}})
|
"err_rms": {"value": err_rms, "unit": ""}})
|
||||||
@@ -174,6 +171,7 @@ class Optimizer:
|
|||||||
forward = None
|
forward = None
|
||||||
training_remain = batch.shape[0]
|
training_remain = batch.shape[0]
|
||||||
batch_row_index = 0
|
batch_row_index = 0
|
||||||
|
|
||||||
while training_remain > 0:
|
while training_remain > 0:
|
||||||
batch_size = min(self.params.mini_batch_size, training_remain)
|
batch_size = min(self.params.mini_batch_size, training_remain)
|
||||||
if batch_size == 0:
|
if batch_size == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user