Skip to content

Commit

Permalink
Merge pull request #889 from dfalbel/prepare-release
Browse files Browse the repository at this point in the history
Prepare 2.2.5.0 release
  • Loading branch information
dfalbel authored Oct 8, 2019
2 parents b76a0e2 + 07a7406 commit d357c68
Show file tree
Hide file tree
Showing 21 changed files with 93 additions and 23 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
^logo.png$

^appveyor\.yml$
^CRAN-RELEASE$
7 changes: 2 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: keras
Type: Package
Title: R Interface to 'Keras'
Version: 2.2.4.1.9001
Version: 2.2.5.0
Authors@R: c(
person("Daniel", "Falbel", role = c("ctb", "cph", "cre"), email = "[email protected]"),
person("JJ", "Allaire", role = c("aut", "cph")),
Expand All @@ -28,7 +28,7 @@ Depends:
Imports:
generics (>= 0.0.1),
reticulate (>= 1.10),
tensorflow (>= 1.13.1),
tensorflow (>= 2.0.0),
tfruns (>= 1.0),
magrittr,
zeallot,
Expand All @@ -45,7 +45,4 @@ SystemRequirements: Keras >= 2.0 (https://keras.io)
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1
VignetteBuilder: knitr
Remotes:
rstudio/reticulate,
rstudio/tensorflow

2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ export(layer_zero_padding_1d)
export(layer_zero_padding_2d)
export(layer_zero_padding_3d)
export(load_model_hdf5)
export(load_model_tf)
export(load_model_weights_hdf5)
export(load_model_weights_tf)
export(load_text_tokenizer)
Expand Down Expand Up @@ -431,6 +432,7 @@ export(regularizer_l2)
export(reset_states)
export(run_dir)
export(save_model_hdf5)
export(save_model_tf)
export(save_model_weights_hdf5)
export(save_model_weights_tf)
export(save_text_tokenizer)
Expand Down
3 changes: 1 addition & 2 deletions R/initializers.R
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ initializer_identity <- function(gain = 1.0) {
#'
#' @section References:
#' - [Self-Normalizing Neural Networks](https://arxiv.org/abs/1706.02515)
#' - [Efficient Backprop](http://yann.lecun.com/exdb/publis/pdf/lecun-98b.pdf)
#' - Efficient Backprop, \cite{LeCun, Yann et al. 1998}
#'
#' @family initializers
#'
Expand Down Expand Up @@ -356,7 +356,6 @@ initializer_he_uniform <- function(seed = NULL) {
#' @inheritParams initializer_random_normal
#'
#' @section References: LeCun 98, Efficient Backprop,
#' http://yann.lecun.com/exdb/publis/pdf/lecun-98b.pdf
#'
#' @family initializers
#'
Expand Down
1 change: 1 addition & 0 deletions man/get_weights.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/initializer_lecun_normal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/initializer_lecun_uniform.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/model_to_json.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/model_to_yaml.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/save_model_hdf5.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions man/save_model_tf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/save_model_weights_hdf5.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/serialize_model.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ if (Sys.getenv("TENSORFLOW_EAGER") == "TRUE")

library(keras)

test_check("keras")
if (identical(Sys.getenv("NOT_CRAN"), "true")) {
test_check("keras")
}
2 changes: 1 addition & 1 deletion tests/testthat/test-applications.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test_succeeds("keras pre-built models can be instantiated", {
application_inception_v3()
})

test_that("can use any input_shape", {
test_succeeds("can use any input_shape", {
x <- application_vgg16(weights = NULL, input_shape = shape(NULL, NULL, 3), include_top = FALSE)
expect_s3_class(x, "keras.engine.training.Model")
})
Expand Down
6 changes: 4 additions & 2 deletions tests/testthat/test-generators.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ test_succeeds("R function can be used as custom generator with multiple inputs",
input1 <- layer_input(shape = 1)
input2 <- layer_input(shape = 1)

out <- layer_add(list(input1, input2))
out <- layer_add(list(input1, input2)) %>%
layer_dense(units = 1)

model <- keras_model(list(input1, input2), out)

Expand All @@ -144,7 +145,8 @@ test_succeeds("Fixed validation_data instead of generator with fit_generator", {
input1 <- layer_input(shape = 1)
input2 <- layer_input(shape = 1)

out <- layer_add(list(input1, input2))
out <- layer_add(list(input1, input2)) %>%
layer_dense(units = 1)

model <- keras_model(list(input1, input2), out)

Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-model-persistence.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ test_succeeds("model can be exported to saved model format", {
if (!tensorflow::tf_version() >= "1.14") skip("Needs TF >= 1.14")

model <- define_and_compile_model()
data <- matrix(rexp(1000*784), nrow = 1000, ncol = 784)
labels <- matrix(round(runif(1000*10, min = 0, max = 9)), nrow = 1000, ncol = 10)

model %>% fit(data, labels, epochs = 2, verbose = 0)

model_dir <- tempfile()
dir.create(model_dir)

Expand Down
14 changes: 11 additions & 3 deletions tests/testthat/test-model.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,24 @@ test_succeeds("can call model with R objects", {
model <- keras_model_sequential() %>%
layer_dense(units = 1, input_shape = 1)

model(matrix(runif(10), ncol = 1))
model(
tensorflow::tf$convert_to_tensor(
matrix(runif(10), ncol = 1),
dtype = tensorflow::tf$float32
)
)

input1 <- layer_input(shape = 1)
input2 <- layer_input(shape = 1)

output <- layer_concatenate(list(input1, input2))

model <- keras_model(list(input1, input2), output)

model(list(matrix(runif(10), ncol = 1), matrix(runif(10), ncol = 1)))
l <- lapply(
list(matrix(runif(10), ncol = 1), matrix(runif(10), ncol = 1)),
function(x) tensorflow::tf$convert_to_tensor(x, dtype = tensorflow::tf$float32)
)
model(l)
})


Expand Down
15 changes: 10 additions & 5 deletions tests/testthat/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ skip_if_no_keras <- function(required_version = NULL) {


test_succeeds <- function(desc, expr, required_version = NULL) {
IPython <- reticulate::import("IPython")
py_capture_output <- IPython$utils$capture$capture_output

py_capture_output <- NULL
if (reticulate::py_module_available("IPython")) {
IPython <- reticulate::import("IPython")
py_capture_output <- IPython$utils$capture$capture_output
}

invisible(
capture.output({
with(py_capture_output(), {
test_that(desc, {
skip_if_no_keras(required_version)
test_that(desc, {
skip_if_no_keras(required_version)
with(py_capture_output(), {
expect_error(force(expr), NA)
})
})
Expand Down
2 changes: 1 addition & 1 deletion vignettes/about_keras_models.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ predictions <- layer_concatenate(c(encoded_a, encoded_b), axis=-1) %>%
model <- keras_model(inputs = c(tweet_a, tweet_b), outputs = predictions)
```

Learn more by reading the [Guide to the Functional API](unctional_api.html).
Learn more by reading the [Guide to the Functional API](functional_api.html).

### Custom

Expand Down
2 changes: 1 addition & 1 deletion vignettes/why_use_keras.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ As such, your Keras model can be trained on a number of different hardware platf

- Keras has [built-in support for multi-GPU data parallelism](https://keras.rstudio.com/reference/multi_gpu_model.html)
- [Horovod](https://github.com/uber/horovod), from Uber, has first-class support for Keras models
- Keras models [can be turned into TensorFlow Estimators](https://www.tensorflow.org/versions/master/api_docs/python/tf/keras/estimator/model_to_estimator) and trained on [clusters of GPUs on Google Cloud](https://cloud.google.com/solutions/running-distributed-tensorflow-on-compute-engine)
- Keras models can be turned into TensorFlow Estimators and trained on [clusters of GPUs on Google Cloud](https://cloud.google.com/solutions/running-distributed-tensorflow-on-compute-engine)
- Keras can be run on Spark via [Dist-Keras](https://github.com/cerndb/dist-keras) (from CERN) and [Elephas](https://github.com/maxpumperla/elephas)

---
Expand Down

0 comments on commit d357c68

Please sign in to comment.