-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in py_call_impl(callable, dots$args, dots$keywords) : #3
Comments
Hi, can you please confirm the original code worked without error before
you changed dates and data sizes?
…On Sat, 10 Apr 2021, 12:22 19211020075, ***@***.***> wrote:
Hi, Andrewzm. When I "run validation...", the following code:
`## For each epoch
for(epoch in 1:nepochs) {
Do all validation cases
cat("Running validation... \n")
N_Val_Batches <- floor(length(idxVal)/32L) # about 237 , 验证
Val_Batch_idx <- rep(1:N_Val_Batches, each = 32L) # batch ID
if((partbatch <- length(idxVal) %% 32L) > 0) { # if not an exact multiple
of 32
N_Val_Batches <- N_Val_Batches + 1 # then there is an extra batch
Val_Batch_idx <- c(Val_Batch_idx, rep(N_Val_Batches, partbatch))
}
Create an idx--batch map
val_batches <- data.frame(idx = idxVal,
batch = Val_Batch_idx)
For each batch compute the NLL
ValCosts <- lapply(unique(val_batches$batch), function(i) {
idx_val <- filter(val_batches, batch == i)$idx
fd <- dict(data_in = d[idx_val,,,],
data_current = dfinal[idx_val,,,drop=F],
data_future = dpred[idx_val,,,drop=F])
run(Cost1, feed_dict = fd)
})
Compute summary statistics at this epoch
Epoch_val[epoch, ] <- c(mean(unlist(ValCosts)),
median(unlist(ValCosts)),
sd(unlist(ValCosts)),
mad(unlist(ValCosts)))
Initialise
epoch_order <- idxTrain
count <- 0
Objective[[epoch]] <- Objective_val[[epoch]] <- rep(0, nsteps_per_epoch)
while(length(epoch_order) >= N_Batch) {
train_cov_pars <- (epoch >= (28L)) # Estimate cov. pars if epoch >= 28
count <- count + 1 # increment batch number in epoch
idx <- epoch_order[1:N_Batch] # Take first N_Batch
epoch_order <- epoch_order[-(1:N_Batch)] # Remove first batch from list
fd <- dict(data_in = d[idx,,,], # Creat dictionary
data_current = dfinal[idx,,,drop=F],
data_future = dpred[idx,,,drop=F])
if(train_cov_pars) {
TFrun <- run(list(trainnetcov, Cost1), feed_dict = fd)
} else {
TFrun <- run(list(trainnet, Cost1), feed_dict = fd) # Train network on its own
}
## Get Cost for this batch
Objective[[epoch]][count] <- TFrun[[2]]
## Every 10 samples do a random validation check
if((count %% 10) == 0) {
idx_val <- sample(idxVal, N_Batch, replace = FALSE)
fd <- dict(data_in = d[idx_val,,,],
data_current = dfinal[idx_val,,,drop=F],
data_future = dpred[idx_val,,,drop=F])
Objective_val[[epoch]][count/10] <- run(Cost1, feed_dict = fd)
cat(paste0("Epoch ", epoch, " ... Step ", count,
" ... Cost: ", Objective_val[[epoch]][count/10], "\n"))
}
Epoch_train[epoch, ] <- c(mean(Objective[[epoch]]),
median(Objective[[epoch]]),
sd(Objective[[epoch]]),
mad(Objective[[epoch]]))
}
}
`
There's an error:
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Dimensions must be equal, but are 64 and 3 for 'Less_2' (op:
'Less') with input shapes: [?,64,64], [?,64,64,3].
Could you please help me? Thanks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABEU3KS5SW7E4KMSPDS7Q3TH6Y5ZANCNFSM42V7QT7Q>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, Andrewzm. When I "run validation...", the following code:
`## For each epoch
for(epoch in 1:nepochs) {
Do all validation cases
cat("Running validation... \n")
N_Val_Batches <- floor(length(idxVal)/32L) # about 237 , 验证
Val_Batch_idx <- rep(1:N_Val_Batches, each = 32L) # batch ID
if((partbatch <- length(idxVal) %% 32L) > 0) { # if not an exact multiple of 32
N_Val_Batches <- N_Val_Batches + 1 # then there is an extra batch
Val_Batch_idx <- c(Val_Batch_idx, rep(N_Val_Batches, partbatch))
}
Create an idx--batch map
val_batches <- data.frame(idx = idxVal,
batch = Val_Batch_idx)
For each batch compute the NLL
ValCosts <- lapply(unique(val_batches$batch), function(i) {
idx_val <- filter(val_batches, batch == i)$idx
fd <- dict(data_in = d[idx_val,,,],
data_current = dfinal[idx_val,,,drop=F],
data_future = dpred[idx_val,,,drop=F])
run(Cost1, feed_dict = fd)
})
Compute summary statistics at this epoch
Epoch_val[epoch, ] <- c(mean(unlist(ValCosts)),
median(unlist(ValCosts)),
sd(unlist(ValCosts)),
mad(unlist(ValCosts)))
Initialise
epoch_order <- idxTrain
count <- 0
Objective[[epoch]] <- Objective_val[[epoch]] <- rep(0, nsteps_per_epoch)
while(length(epoch_order) >= N_Batch) {
}
}
`
There's an error:
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Dimensions must be equal, but are 64 and 3 for 'Less_2' (op: 'Less') with input shapes: [?,64,64], [?,64,64,3].
Could you please help me? Thanks.
The text was updated successfully, but these errors were encountered: