-
Notifications
You must be signed in to change notification settings - Fork 283
Open
Labels
Description
Hi,
I am running the vignette neural_style_transfer and I encountered this error:
for (layer_name in style_layers){
layer_features <- outputs_dict[[layer_name]]
style_reference_features <- layer_features[2,,,]
combination_features <- layer_features[3,,,]
K$clear_session()
sl <- style_loss(style_reference_features, combination_features)
loss <- loss + ((style_weight / length(style_layers)) * sl)
}
Error:
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Tensor("Const:0", shape=(1,), dtype=int32) must be from the same graph as Tensor("strided_slice_4:0", shape=(2,), dtype=int32).
> traceback()
5: stop(list(message = "ValueError: Tensor(\"Const:0\", shape=(1,), dtype=int32) must be from the same graph as Tensor(\"strided_slice_4:0\", shape=(2,), dtype=int32).",
call = py_call_impl(callable, dots$args, dots$keywords),
cppstack = NULL))
4: py_call_impl(callable, dots$args, dots$keywords)
3: K$batch_flatten(K$permute_dimensions(x, list(2L, 0L, 1L))) at #2
2: gram_matrix(style) at #2
1: style_loss(style_reference_features, combination_features)
SessionInfo:
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] keras_2.3.0.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 lattice_0.20-38 zeallot_0.1.0 rappdirs_0.3.1 grid_3.6.3
[6] R6_2.4.1 jsonlite_1.7.1 magrittr_1.5 tfruns_1.4 whisker_0.4
[11] Matrix_1.2-18 reticulate_1.16 generics_0.0.2 tools_3.6.3 compiler_3.6.3
[16] base64enc_0.1-3 tensorflow_2.2.0
How do I fix this error?