Skip to content

Commit 7ea3cae

Browse files
committed
Mark deprecated functions with @keywords internal
To prevent them showing up in the package documentation index.
1 parent 1079a26 commit 7ea3cae

27 files changed

+64
-24
lines changed

NEWS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
- Fixed error raised when `k_random_binomial()` was passed a non-floating dtype.
3232
- Added `k_random_bernouli()` as an alias for `k_random_binomial()`.
3333

34-
- `image_laod()` gains a `color_mode` argument.
34+
- `image_load()` gains a `color_mode` argument.
35+
36+
- Deprecated functions are no longer included in the package documentation index.
3537

3638
# keras 2.7.0
3739

R/backend.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,9 @@ k_log <- function(x) {
15951595
}
15961596

15971597

1598-
#' Computes log(sum(exp(elements across dimensions of a tensor))).
1598+
#' (Deprecated) Computes log(sum(exp(elements across dimensions of a tensor))).
1599+
#'
1600+
#' This funciton is deprecated. Please use `tensorflow::tf$reduce_logsumexp()`.
15991601
#'
16001602
#' This function is more numerically stable than log(sum(exp(x))). It avoids
16011603
#' overflows caused by taking the exp of large inputs and underflows caused by
@@ -1611,6 +1613,7 @@ k_log <- function(x) {
16111613
#'
16121614
#' @template roxlate-keras-backend
16131615
#'
1616+
#' @keywords internal
16141617
#' @export
16151618
k_logsumexp <- function(x, axis = NULL, keepdims = FALSE) {
16161619

R/callbacks.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ callback_lambda <- function(on_epoch_begin = NULL, on_epoch_end = NULL,
495495
#' (Deprecated) Base R6 class for Keras callbacks
496496
#'
497497
#' New custom callbacks implemented as R6 classes are encouraged to inherit from
498-
#' keras$callbacks$Callback directly.
498+
#' `keras$callbacks$Callback` directly.
499499
#'
500500
#' @docType class
501501
#'
@@ -526,7 +526,7 @@ callback_lambda <- function(on_epoch_begin = NULL, on_epoch_end = NULL,
526526
#' - `on_batch_end`: logs include `loss`, and optionally `acc` (if accuracy monitoring is enabled).
527527
#'
528528
#' @return [KerasCallback].
529-
#'
529+
#' @keywords internal
530530
#' @examples
531531
#' \dontrun{
532532
#' library(keras)

R/constraints.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ constraint_minmaxnorm <- function(min_value = 0.0, max_value = 1.0, rate = 1.0,
122122
#'
123123
#' @seealso [constraints]
124124
#'
125+
#' @keywords internal
125126
#' @export
126127
KerasConstraint <- R6::R6Class("KerasConstraint",
127128
public = list(

R/layer-custom.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#'
77
#' @docType class
88
#'
9-
#' @format An [R6Class] generator object #'
9+
#' @format An [R6Class] generator object
1010
#' @section Methods: \describe{ \item{\code{build(input_shape)}}{Creates the
1111
#' layer weights (must be implemented by all layers that have weights)}
1212
#' \item{\code{call(inputs,mask)}}{Call the layer on an input tensor.}
@@ -18,6 +18,8 @@
1818
#'
1919
#' @return [KerasLayer].
2020
#'
21+
#' @keywords internal
22+
#'
2123
#' @export
2224
KerasLayer <- R6Class("KerasLayer",
2325

R/layers-recurrent.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function(object,
165165

166166

167167

168-
#' Fast GRU implementation backed by [CuDNN](https://developer.nvidia.com/cudnn).
168+
#' (Deprecated) Fast GRU implementation backed by [CuDNN](https://developer.nvidia.com/cudnn).
169169
#'
170170
#' Can only be run on GPU, with the TensorFlow backend.
171171
#'
@@ -184,6 +184,7 @@ function(object,
184184
#' Application of Dropout in Recurrent Neural
185185
#' Networks](https://arxiv.org/abs/1512.05287)
186186
#'
187+
#' @keywords internal
187188
#' @export
188189
layer_cudnn_gru <- function(object, units,
189190
kernel_initializer = "glorot_uniform", recurrent_initializer = "orthogonal", bias_initializer = "zeros",
@@ -282,7 +283,7 @@ function(object,
282283
create_layer(keras$layers$LSTM, object, args)
283284
}
284285

285-
#' Fast LSTM implementation backed by [CuDNN](https://developer.nvidia.com/cudnn).
286+
#' (Deprecated) Fast LSTM implementation backed by [CuDNN](https://developer.nvidia.com/cudnn).
286287
#'
287288
#' Can only be run on GPU, with the TensorFlow backend.
288289
#'
@@ -296,6 +297,7 @@ function(object,
296297
#'
297298
#' @family recurrent layers
298299
#'
300+
#' @keywords internal
299301
#' @export
300302
layer_cudnn_lstm <- function(object, units,
301303
kernel_initializer = "glorot_uniform", recurrent_initializer = "orthogonal",

R/losses.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ c("squared_hinge", "SquaredHinge")
366366
#'
367367
#' @param ... passed on to [loss_cosine_similarity()]
368368
#'
369+
#' @keywords internal
369370
#' @export
370371
loss_cosine_proximity <- function(...) {
371372
warning("loss_cosine_proximity is deprecated and will be removed in a future version.",

R/metrics.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,7 @@ custom_metric <- function(name, metric_fn) {
13241324
#' `tensorflow::tf$compat$v1$keras$metrics$cosine_proximity()`
13251325
#'
13261326
#' @inheritParams metric-or-Metric
1327+
#' @keywords internal
13271328
#' @export
13281329
metric_cosine_proximity <- function(y_true, y_pred) {
13291330
warning(

R/model-persistence.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ export_savedmodel.keras.engine.training.Model <- function(
473473
invisible(export_dir_base)
474474
}
475475

476-
#' Export to Saved Model format
476+
#' (Deprecated) Export to Saved Model format
477477
#'
478478
#' @param model A Keras model to be saved. If the model is subclassed, the flag
479479
#' `serving_only` must be set to `TRUE`.
@@ -493,6 +493,7 @@ export_savedmodel.keras.engine.training.Model <- function(
493493
#' @return Invisibly returns the `saved_model_path`.
494494
#' @family saved_model
495495
#'
496+
#' @keywords internal
496497
#' @export
497498
model_to_saved_model <- function(model, saved_model_path, custom_objects = NULL,
498499
as_text = FALSE, input_signature = NULL,

R/model.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ sequential_model_input_layer <- function(input_shape = NULL,
145145

146146

147147

148-
#' Replicates a model on different GPUs.
148+
#' (Deprecated) Replicates a model on different GPUs.
149149
#'
150150
#' @param model A Keras model instance. To avoid OOM errors,
151151
#' this model could have been built on CPU, for instance
@@ -247,6 +247,7 @@ sequential_model_input_layer <- function(input_shape = NULL,
247247
#' classes = num_classes
248248
#' })
249249
#' ```
250+
#' @keywords internal
250251
#' @export
251252
multi_gpu_model <- function(model, gpus = NULL, cpu_merge = TRUE, cpu_relocation = FALSE) {
252253

@@ -933,6 +934,7 @@ predict.keras.engine.training.Model <- function(object, x, batch_size=NULL, verb
933934
#'
934935
#' @family model functions
935936
#'
937+
#' @keywords internal
936938
#' @export
937939
predict_proba <- function(object, x, batch_size = NULL, verbose = 0, steps = NULL) {
938940
warning("`predict_proba()` is deprecated and was removed from tensorflow in version 2.6, ",
@@ -957,6 +959,7 @@ predict_proba <- function(object, x, batch_size = NULL, verbose = 0, steps = NUL
957959
}
958960

959961
#' @rdname predict_proba
962+
#' @keywords internal
960963
#' @export
961964
predict_classes <- function(object, x, batch_size = NULL, verbose = 0, steps = NULL) {
962965
warning(
@@ -1048,7 +1051,7 @@ test_on_batch <- function(object, x, y, sample_weight = NULL) {
10481051

10491052

10501053

1051-
#' Fits the model on data yielded batch-by-batch by a generator.
1054+
#' (Deprecated) Fits the model on data yielded batch-by-batch by a generator.
10521055
#'
10531056
#' The generator is run in parallel to the model, for efficiency. For instance,
10541057
#' this allows you to do real-time data augmentation on images on CPU in
@@ -1111,6 +1114,7 @@ test_on_batch <- function(object, x, y, sample_weight = NULL) {
11111114
#'
11121115
#' @family model functions
11131116
#'
1117+
#' @keywords internal
11141118
#' @export
11151119
fit_generator <- function(object, generator, steps_per_epoch, epochs = 1,
11161120
verbose=getOption("keras.fit_verbose", default = 1), callbacks = NULL,
@@ -1155,7 +1159,7 @@ fit_generator <- function(object, generator, steps_per_epoch, epochs = 1,
11551159
do.call(fit, args)
11561160
}
11571161

1158-
#' Evaluates the model on a data generator.
1162+
#' (Deprecated) Evaluates the model on a data generator.
11591163
#'
11601164
#' The generator should return the same kind of data as accepted by
11611165
#' `test_on_batch()`.
@@ -1173,6 +1177,7 @@ fit_generator <- function(object, generator, steps_per_epoch, epochs = 1,
11731177
#'
11741178
#' @family model functions
11751179
#'
1180+
#' @keywords internal
11761181
#' @export
11771182
evaluate_generator <- function(object, generator, steps, max_queue_size = 10, workers = 1,
11781183
callbacks = NULL) {
@@ -1197,7 +1202,7 @@ evaluate_generator <- function(object, generator, steps, max_queue_size = 10, wo
11971202
}
11981203

11991204

1200-
#' Generates predictions for the input samples from a data generator.
1205+
#' (Deprecated) Generates predictions for the input samples from a data generator.
12011206
#'
12021207
#' The generator should return the same kind of data as accepted by
12031208
#' `predict_on_batch()`.
@@ -1218,6 +1223,7 @@ evaluate_generator <- function(object, generator, steps, max_queue_size = 10, wo
12181223
#'
12191224
#' @family model functions
12201225
#'
1226+
#' @keywords internal
12211227
#' @export
12221228
predict_generator <- function(object, generator, steps, max_queue_size = 10, workers = 1, verbose = 0,
12231229
callbacks = NULL) {

0 commit comments

Comments
 (0)