File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -224,14 +224,13 @@ keras_array <- function(x, dtype = NULL) {
224224 if (
225225 tf_version() > = " 1.12" &&
226226 (
227- tensorflow :: tf $ contrib $ framework $ is_tensor(x ) ||
228- is.list(x ) && all(vapply(x , tensorflow :: tf $ contrib $ framework $ is_tensor , logical (1 )))
227+ is_keras_tensor(x ) || is.list(x ) && all(vapply(x , is_keras_tensor , logical (1 )))
229228 )
230229 ) {
231230 return (x )
232231 }
233232 } else {
234- if ((keras_version() > = " 2.2.0" ) && k_is_tensor (x )) {
233+ if ((keras_version() > = " 2.2.0" ) && is_keras_tensor (x )) {
235234 return (x )
236235 }
237236 }
@@ -381,3 +380,11 @@ as_shape <- function(x) {
381380 as.integer(d )
382381 })
383382}
383+
384+ is_keras_tensor <- function (x ) {
385+ if (is_tensorflow_implementation()) {
386+ if (tensorflow :: tf_version() > = " 2.0" ) tensorflow :: tf $ is_tensor(x ) else tensorflow :: tf $ contrib $ framework $ is_tensor(x )
387+ } else {
388+ k_is_tensor(x )
389+ }
390+ }
You can’t perform that action at this time.
0 commit comments