Skip to content

Commit b4afc0c

Browse files
author
Sigrid Keydana
committed
switch to tf.keras as default implementation
1 parent aae09de commit b4afc0c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
## Development version
3+
4+
- Use `tf.keras` as default implementation module.
5+
6+
27
## Keras 2.2.4 (CRAN)
38

49
- Improve handling of `timeseries_generator()` in calls to `fit_generator()`

R/package.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ use_backend <- function(backend = c("tensorflow", "cntk", "theano", "plaidml"))
7777
} else {
7878
Sys.setenv(KERAS_BACKEND = match.arg(backend))
7979
}
80+
if (backend != "tensorflow") use_implementation("keras")
8081
}
8182

8283

@@ -87,6 +88,8 @@ keras <- NULL
8788

8889
# resolve the implementaiton module (might be keras proper or might be tensorflow)
8990
implementation_module <- resolve_implementation_module()
91+
if (implementation_module == "tensorflow.python.keras")
92+
Sys.setenv(KERAS_IMPLEMENTATION = "tensorflow")
9093

9194
# if KERAS_PYTHON is defined then forward it to RETICULATE_PYTHON
9295
keras_python <- get_keras_python()
@@ -160,7 +163,7 @@ resolve_implementation_module <- function() {
160163
implementation_module
161164
}
162165

163-
get_keras_implementation <- function(default = "keras") {
166+
get_keras_implementation <- function(default = "tensorflow") {
164167
get_keras_option("KERAS_IMPLEMENTATION", default = default)
165168
}
166169

0 commit comments

Comments
 (0)