About Keras Layers

knitr::opts_chunk$set(comment = NA, eval = FALSE)


Keras layers are the fundamental building block of keras models. Layers are created using a wide variety of layer_ functions and are typically composed together by stacking calls to them using the pipe %>% operator. For example:

model <- keras_model_sequential() 
model %>% 
  layer_dense(units = 32, input_shape = c(784)) %>% 
  layer_activation('relu') %>% 
  layer_dense(units = 10) %>% 

A wide variety of layers are available, including:


All layers share the following properties:


The following functions are available for interacting with layers:

`get_config()` `from_config()`

Layer/Model configuration

`get_weights()` `set_weights()`

Layer/Model weights as R arrays


Count the total number of scalars composing the weights.

`get_input_at()` `get_output_at()` `get_input_shape_at()` `get_output_shape_at()` `get_input_mask_at()` `get_output_mask_at()`

Retrieve tensors for layers with multiple nodes


Reset the states for a layer

Try the keras package in your browser

Any scripts or data that you put into this service are public.

keras documentation built on Oct. 9, 2019, 1:04 a.m.