get_layer: Retrieves a layer based on either its name (unique) or index.

View source: R/model-creation.R

get_layerR Documentation

Retrieves a layer based on either its name (unique) or index.

Description

Indices are based on order of horizontal graph traversal (bottom-up) and are 1-based. If name and index are both provided, index will take precedence.

Usage

get_layer(object, name = NULL, index = NULL)

Arguments

object

Keras model object

name

String, name of layer.

index

Integer, index of layer (1-based). Also valid are negative values, which count from the end of model.

Value

A layer instance.

See Also

Other model functions:
get_config()
keras_model()
keras_model_sequential()
pop_layer()
summary.keras.src.models.model.Model()


rstudio/keras documentation built on April 27, 2024, 10:11 p.m.