Skip to content

Commit 1079a26

Browse files
committed
Deprecate keras_model_custom()
1 parent 2f6c819 commit 1079a26

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

NEWS.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,31 @@
22

33
- Breaking change: The semantics of passing a named list to `keras_model()` have changed.
44

5-
Previously, `keras_model()` would `unname()` supplied `inputs` and `outputs`.
6-
Then, if a named list was passed to subsequent
7-
`fit()`/`evaluate()`/`call()`/`predict()` invocations,
8-
matching of `x` and `y` was done to the model's `tensor$name`'s.
5+
Previously, `keras_model()` would `unname()` supplied `inputs` and `outputs`.
6+
Then, if a named list was passed to subsequent
7+
`fit()`/`evaluate()`/`call()`/`predict()` invocations,
8+
matching of `x` and `y` was done to the model's `tensor$name`'s.
99
Now, matching is done to `names()` of `inputs` and/or `outputs`.
1010
Call `unname()` on `inputs` and `outputs` to restore the old behavior, e.g.:
1111
```keras_model(unname(inputs), unname(outputs))```
1212

13-
`keras_model()` can now accept a named list for multi-input and/or multi-output
13+
`keras_model()` can now accept a named list for multi-input and/or multi-output
1414
models. (Requires Tensorflow >= 2.4). The named list is converted to a `dict` in python.
15-
15+
1616
If `inputs` is a named list:
17-
- `call()`, `fit()`, `evaluate()`, and `predict()` methods can also
18-
accept a named list for `x`, with names matching to the
17+
- `call()`, `fit()`, `evaluate()`, and `predict()` methods can also
18+
accept a named list for `x`, with names matching to the
1919
names of `inputs` when the model was constructed.
2020
Positional matching of `x` is still also supported (requires python 3.7+).
21-
21+
2222
If `outputs` is a named list:
2323
- `fit()` and `evaluate()` methods can *only*
24-
accept a named list for `y`, with names matching to the
24+
accept a named list for `y`, with names matching to the
2525
names of `outputs` when the model was constructed.
26-
26+
27+
- `keras_model_custom()` is soft deprecated. Please define custom models by
28+
subclassing `keras$Model` directly using `%py_class%` or `R6::R6Class()`.
29+
2730
- Fixed warning issued by `k_random_binomial()`.
2831
- Fixed error raised when `k_random_binomial()` was passed a non-floating dtype.
2932
- Added `k_random_bernouli()` as an alias for `k_random_binomial()`.

R/model-custom.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11

2-
#' Create a Keras custom model
2+
#' (Deprecated) Create a Keras custom model
3+
#'
4+
#' `keras_model_custom()` is soft-deprecated. Please define custom models by
5+
#' subclassing `keras$Model` directly using [`%py_class%`] or [`R6::R6Class()`].
36
#'
47
#' @param model_fn Function that returns an R custom model
58
#' @param name Optional name for model
69
#'
710
#' @return A Keras model
811
#'
9-
#' @details For documentation on using custom models,
10-
#' see <https://keras.rstudio.com/articles/custom_models.html>.
12+
#' @details For documentation on using custom models, see
13+
#' <https://keras.rstudio.com/articles/custom_models.html>.
1114
#'
15+
#' @keywords internal
1216
#' @export
1317
keras_model_custom <- function(model_fn, name = NULL) {
1418

man/keras_model_custom.Rd

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)