R/package.R

use_implementation

Select a Keras implementation and backend

Description

Select a Keras implementation and backend

Usage

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

Arguments

Arguments Description
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

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