TensorFlow 2.0 Beta is available Learn more

tf.contrib.eager.Sequential

View source on GitHub

Class Sequential

Represents a linear sequence of Layers or functions.

Inherits From: Network

The output of each layer/function is provided as the input to the next. The inputs passed to __call__ are passed to the inputs of the first Layer, and it returns the outputs of the last Layer.

Args:

  • layers_funcs: An optional sequence where each element is either a tf.compat.v1.layers.Layer object or a callable.
  • name: An optional string name to use for this Network.

__init__

View source

__init__(
    layers_funcs=None,
    name=None
)

Properties

graph

DEPRECATED FUNCTION

layers

scope_name

Methods

add

View source

add(layer_func)

get_layer

View source

get_layer(
    name=None,
    index=None
)

Get a contained tf.compat.v1.layers.Layer either by name or index.

Args:

  • name: String matching one of the names of a contained Layer. Note that the names of Layers added to Networks may not be unique when doing layer sharing (i.e. adding a Layer to this Network which was already added to another Network). The lowest index Layer with a matching name will be returned.
  • index: Integer in [0, number of layers). Layers are assigned an index by the order they are added.

Returns:

A tf.compat.v1.layers.Layer object.

Raises:

  • ValueError: If neither or both of 'index' or 'name' is specified, or the lookup failed.

track_layer

View source

track_layer(layer)

Track a Layer in this Network.

Network requires that all Layers used in call() be tracked so that the Network can export a complete list of variables.

Args:

Returns:

The passed in layer.

Raises:

  • RuntimeError: If init has not been called.
  • TypeError: If layer is the wrong type.
  • ValueError: If a Layer with the same name has already been added.