diff --git a/NAMESPACE b/NAMESPACE index 90923cbfe..fed462848 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -75,6 +75,7 @@ export(image_load) export(image_to_array) export(imagenet_decode_predictions) export(imagenet_preprocess_input) +export(implementation) export(inception_v3_preprocess_input) export(initializer_constant) export(initializer_glorot_normal) diff --git a/R/utils.R b/R/utils.R index 0c51f1b74..64aa42d4e 100644 --- a/R/utils.R +++ b/R/utils.R @@ -109,6 +109,28 @@ normalize <- function(x, axis = -1, order = 2) { } +#' Keras implementation +#' +#' Obtain a reference to the Python module used for the implementation of Keras. +#' +#' There are currently two Python modules which implement Keras: +#' +#' - keras ("keras") +#' - tensorflow.contrib.keras ("tensorflow") +#' +#' This function returns a reference to the implementation being currently +#' used by the keras package. The default implementation is "tensorflow". +#' You can override this by setting the `KERAS_IMPLEMENTATION` environment +#' variable to "keras". +#' +#' @return Reference to the Python module used for the implementation of Keras. +#' +#' @export +implementation <- function() { + keras +} + + #' Keras backend tensor engine #' #' Obtain a reference to the `keras.backend` Python module used to implement diff --git a/man/implementation.Rd b/man/implementation.Rd new file mode 100644 index 000000000..373551f52 --- /dev/null +++ b/man/implementation.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{implementation} +\alias{implementation} +\title{Keras implementation} +\usage{ +implementation() +} +\value{ +Reference to the Python module used for the implementation of Keras. +} +\description{ +Obtain a reference to the Python module used for the implementation of Keras. +} +\details{ +There are currently two Python modules which implement Keras: +\itemize{ +\item keras ("keras") +\item tensorflow.contrib.keras ("tensorflow") +} + +This function returns a reference to the implementation being currently +used by the keras package. The default implementation is "tensorflow". +You can override this by setting the \code{KERAS_IMPLEMENTATION} environment +variable to "keras". +}