use_implementation: Select a Keras implementation and backend

Description Usage Arguments Details Examples

View source: R/package.R

Description

Select a Keras implementation and backend

Usage

1
2
3
use_implementation(implementation = c("keras", "tensorflow"))

use_backend(backend = c("tensorflow", "cntk", "theano", "plaidml"))

Arguments

implementation

One of "keras" or "tensorflow" (defaults to "keras").

backend

One of "tensorflow", "cntk", or "theano" (defaults to "tensorflow")

Details

Keras has multiple implementations (the original keras implementation and the implementation native to TensorFlow) and supports multiple backends ("tensorflow", "cntk", "theano", and "plaidml"). These functions allow switching between the various implementations and backends.

The functions should be called after library(keras) and before calling other functions within the package (see below for an example).

The default implementation and backend should be suitable for most use cases. The "tensorflow" implementation is useful when using Keras in conjunction with TensorFlow Estimators (the tfestimators R package).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# use the tensorflow implementation
library(keras)
use_implementation("tensorflow")

# use the cntk backend
library(keras)
use_backend("theano")

## End(Not run)

dfalbel/keras documentation built on Nov. 27, 2019, 8:16 p.m.