Skip to content

Commit

Permalink
remove layer_wrapper(), create_wrapper, KerasWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kalinowski committed Oct 11, 2023
1 parent ff7d4bc commit e7fdfac
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 268 deletions.
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ export(constraint_unitnorm)
export(count_params)
export(create_layer)
export(create_layer_wrapper)
export(create_wrapper)
export(custom_metric)
export(dataset_boston_housing)
export(dataset_cifar10)
Expand Down Expand Up @@ -485,7 +484,6 @@ export(layer_unit_normalization)
export(layer_upsampling_1d)
export(layer_upsampling_2d)
export(layer_upsampling_3d)
export(layer_wrapper)
export(layer_zero_padding_1d)
export(layer_zero_padding_2d)
export(layer_zero_padding_3d)
Expand Down
37 changes: 0 additions & 37 deletions R/autogen-layers-core.R
Original file line number Diff line number Diff line change
Expand Up @@ -758,40 +758,3 @@ function (object, mask_value = 0, ...)
ignore = "object")
create_layer(keras$layers$Masking, object, args)
}


# keras$layers$Wrapper
# keras_core.src.layers.core.wrapper.Wrapper
r"-(Abstract wrapper base class.
Wrappers take another layer and augment it in various ways.
Do not use this class as a layer, it is only an abstract base class.
Two usable wrappers are the `TimeDistributed` and `Bidirectional` layers.
Args:
layer: The layer to be wrapped.
)-"


# keras_core.src.layers.core.wrapper.Wrapper
#' Abstract wrapper base class.
#'
#' @description
#' Wrappers take another layer and augment it in various ways.
#' Do not use this class as a layer, it is only an abstract base class.
#' Two usable wrappers are the `TimeDistributed` and `Bidirectional` layers.
#'
#' @param layer The layer to be wrapped.
#'
#' @export
#' @family core layers
#' @seealso
#' + <https://www.tensorflow.org/api_docs/python/tf/keras/layers/Wrapper>
layer_wrapper <-
function (object, layer, ...)
{
args <- capture_args2(list(input_shape = normalize_shape,
batch_size = as_integer, batch_input_shape = normalize_shape),
ignore = "object")
create_layer(keras$layers$Wrapper, object, args)
}
147 changes: 0 additions & 147 deletions R/wrapper_custom.R

This file was deleted.

29 changes: 0 additions & 29 deletions man/create_wrapper.Rd

This file was deleted.

3 changes: 1 addition & 2 deletions man/layer_dense.Rd

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

3 changes: 1 addition & 2 deletions man/layer_einsum_dense.Rd

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

3 changes: 1 addition & 2 deletions man/layer_embedding.Rd

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

3 changes: 1 addition & 2 deletions man/layer_identity.Rd

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

3 changes: 1 addition & 2 deletions man/layer_lambda.Rd

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

3 changes: 1 addition & 2 deletions man/layer_masking.Rd

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

30 changes: 0 additions & 30 deletions man/layer_wrapper.Rd

This file was deleted.

2 changes: 1 addition & 1 deletion tests/testthat/test-custom_wrappers.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
context("custom-wrappers")



skip("custom wrappers") # but custom R6 w/ inherits = keras$layers$Wrapper should still work but doesn't...
# Custom wrapper class
CustomWrapper <- R6::R6Class(
"CustomWrapper",
Expand Down
24 changes: 14 additions & 10 deletions tools/make.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,20 @@ endpoints <-
# # "keras.applications.convnext" is a module, filtered out, has good stuff
# }) |>
unlist() %>%
setdiff(c("keras.layers.Layer",
"keras.layers.InputLayer",
"keras.layers.InputSpec",
"keras.optimizers.Optimizer",
"keras.regularizers.Regularizer",
"keras.constraints.Constraint",
"keras.initializers.Initializer",
"keras.callbacks.CallbackList",
"keras.callbacks.History",
"keras.callbacks.Callback"))
setdiff(c %(% {
"keras.layers.Layer" # only for subclassing
"keras.optimizers.Optimizer" # only for subclassing
"keras.regularizers.Regularizer" # only for subclassing
"keras.constraints.Constraint" # only for subclassing
"keras.initializers.Initializer" # only for subclassing
"keras.callbacks.Callback" # only for subclassing

"keras.layers.Wrapper" # needs thinking
"keras.layers.InputLayer" # use Input instead
"keras.layers.InputSpec" # ??
"keras.callbacks.CallbackList" # just an abstract list
"keras.callbacks.History" # always added to by default
})

df <-
endpoints |>
Expand Down

0 comments on commit e7fdfac

Please sign in to comment.