Skip to content

Commit bde52b8

Browse files
committed
rename step -> step_valid in callback
1 parent be34408 commit bde52b8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

R/learner_torch_methods.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ torch_network_predict_valid = function(ctx, callback_receiver = function(step_na
241241
one_arg = has_one_arg(network)
242242
predictions = vector("list", length = length(loader))
243243
valid_iterator = dataloader_make_iter(loader)
244-
ctx$step = 0L
245-
while (ctx$step < length(loader)) {
246-
ctx$step = ctx$step + 1L
244+
ctx$step_valid = 0L
245+
while (ctx$step_valid < length(loader)) {
246+
ctx$step_valid = ctx$step_valid + 1L
247247
ctx$batch = dataloader_next(valid_iterator)
248248
ctx$batch$x = lapply(ctx$batch$x, function(x) x$to(device = ctx$device))
249249

250250
callback_receiver("on_batch_valid_begin")
251-
predictions[[ctx$step]] = if (one_arg) {
251+
predictions[[ctx$step_valid]] = if (one_arg) {
252252
with_no_grad(network$forward(ctx$batch$x[[1L]]))
253253
} else {
254254
with_no_grad(invoke(network$forward, .args = ctx$batch$x))

0 commit comments

Comments
 (0)