Layers

Default layer: Function with default argument function

Convolutional layers

class tensorforce.core.layers.Conv1d(name, size, window=3, stride=1, padding='same', dilation=1, bias=True, activation='relu', dropout=0.0, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None)[source]

1-dimensional convolutional layer (specification key: conv1d).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • window (int > 0) – Window size (default: 3).
  • stride (int > 0) – Stride size (default: 1).
  • padding ('same' | 'valid') – Padding type, see TensorFlow docs (default: ‘same’).
  • dilation (int > 0 | (int > 0, int > 0)) – Dilation value (default: 1).
  • bias (bool) – Whether to add a trainable bias variable (default: true).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (activation) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Activation nonlinearity (default: relu).
  • dropout (parameter, 0.0 <= float < 1.0) – Dropout rate (default: 0.0).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
class tensorforce.core.layers.Conv2d(name, size, window=3, stride=1, padding='same', dilation=1, bias=True, activation='relu', dropout=0.0, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None)[source]

2-dimensional convolutional layer (specification key: conv2d).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • window (int > 0 | (int > 0, int > 0)) – Window size (default: 3).
  • stride (int > 0 | (int > 0, int > 0)) – Stride size (default: 1).
  • padding ('same' | 'valid') – Padding type, see TensorFlow docs (default: ‘same’).
  • dilation (int > 0 | (int > 0, int > 0)) – Dilation value (default: 1).
  • bias (bool) – Whether to add a trainable bias variable (default: true).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (activation) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Activation nonlinearity (default: “relu”).
  • dropout (parameter, 0.0 <= float < 1.0) – Dropout rate (default: 0.0).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).

Dense layers

class tensorforce.core.layers.Dense(name, size, bias=True, activation='tanh', dropout=0.0, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None)[source]

Dense fully-connected layer (specification key: dense).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • bias (bool) – Whether to add a trainable bias variable (default: true).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (activation) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Activation nonlinearity (default: tanh).
  • dropout (parameter, 0.0 <= float < 1.0) – Dropout rate (default: 0.0).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
class tensorforce.core.layers.Linear(name, size, bias=True, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None)[source]

Linear layer (specification key: linear).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • bias (bool) – Whether to add a trainable bias variable (default: true).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).

Embedding layers

class tensorforce.core.layers.Embedding(name, size, num_embeddings=None, max_norm=None, bias=True, activation='tanh', dropout=0.0, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None)[source]

Embedding layer (specification key: embedding).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • num_embeddings (int > 0) – If set, specifies the number of embeddings (default: none).
  • max_norm (float) – If set, embeddings are clipped if their L2-norm is larger (default: none).
  • bias (bool) – Whether to add a trainable bias variable (default: true).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (activation) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Activation nonlinearity (default: tanh).
  • dropout (parameter, 0.0 <= float < 1.0) – Dropout rate (default: 0.0).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
  • kwargs – Additional arguments for potential parent class.

Recurrent layers

class tensorforce.core.layers.Gru(name, size, return_final_state=True, bias=False, activation=None, dropout=0.0, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None, **kwargs)[source]

Gated recurrent unit layer (specification key: gru).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • cell ('gru' | 'lstm') – The recurrent cell type (required).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • return_final_state (bool) – Whether to return the final state instead of the per-step outputs (default: true).
  • bias (bool) – Whether to add a trainable bias variable (default: false).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (activation) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Activation nonlinearity (default: none).
  • dropout (parameter, 0.0 <= float < 1.0) – Dropout rate (default: 0.0).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
  • kwargs – Additional arguments for Keras GRU layer, see TensorFlow docs.
class tensorforce.core.layers.Lstm(name, size, return_final_state=True, bias=False, activation=None, dropout=0.0, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None, **kwargs)[source]

Long short-term memory layer (specification key: lstm).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • cell ('gru' | 'lstm') – The recurrent cell type (required).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • return_final_state (bool) – Whether to return the final state instead of the per-step outputs (default: true).
  • bias (bool) – Whether to add a trainable bias variable (default: false).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (activation) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Activation nonlinearity (default: none).
  • dropout (parameter, 0.0 <= float < 1.0) – Dropout rate (default: 0.0).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
  • kwargs – Additional arguments for Keras LSTM layer, see TensorFlow docs.
class tensorforce.core.layers.Rnn(name, cell, size, return_final_state=True, bias=True, activation='tanh', dropout=0.0, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None, **kwargs)[source]

Recurrent neural network layer (specification key: rnn).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • cell ('gru' | 'lstm') – The recurrent cell type (required).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • return_final_state (bool) – Whether to return the final state instead of the per-step outputs (default: true).
  • bias (bool) – Whether to add a trainable bias variable (default: true).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (activation) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Activation nonlinearity (default: tanh).
  • dropout (parameter, 0.0 <= float < 1.0) – Dropout rate (default: 0.0).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
  • kwargs – Additional arguments for Keras RNN layer, see TensorFlow docs.

Pooling layers

class tensorforce.core.layers.Flatten(name, input_spec=None, summary_labels=None)[source]

Flatten layer (specification key: flatten).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Pooling(name, reduction, input_spec=None, summary_labels=None)[source]

Pooling layer (global pooling) (specification key: pooling).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • reduction ('concat' | 'max' | 'mean' | 'product' | 'sum') – Pooling type (required).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Pool1d(name, reduction, window=2, stride=2, padding='same', input_spec=None, summary_labels=None)[source]

1-dimensional pooling layer (local pooling) (specification key: pool1d).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • reduction ('average' | 'max') – Pooling type (required).
  • window (int > 0) – Window size (default: 2).
  • stride (int > 0) – Stride size (default: 2).
  • padding ('same' | 'valid') – Padding type, see TensorFlow docs (default: ‘same’).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Pool2d(name, reduction, window=2, stride=2, padding='same', input_spec=None, summary_labels=None)[source]

2-dimensional pooling layer (local pooling) (specification key: pool2d).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • reduction ('average' | 'max') – Pooling type (required).
  • window (int > 0 | (int > 0, int > 0)) – Window size (default: 2).
  • stride (int > 0 | (int > 0, int > 0)) – Stride size (default: 2).
  • padding ('same' | 'valid') – Padding type, see TensorFlow docs (default: ‘same’).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).

Normalization layers

class tensorforce.core.layers.ExponentialNormalization(name, decay=0.999, axes=None, input_spec=None, summary_labels=None)[source]

Normalization layer based on the exponential moving average (specification key: exponential_normalization).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • decay (parameter, 0.0 <= float <= 1.0) – Decay rate (default: 0.999).
  • axes (iter[int >= 0]) – Normalization axes, excluding batch axis (default: all but last axis).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
class tensorforce.core.layers.InstanceNormalization(name, axes=None, input_spec=None, summary_labels=None)[source]

Instance normalization layer (specification key: instance_normalization).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • axes (iter[int >= 0]) – Normalization axes, excluding batch axis (default: all).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).

Misc layers

class tensorforce.core.layers.Activation(name, nonlinearity, input_spec=None, summary_labels=None)[source]

Activation layer (specification key: activation).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (nonlinearity) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Nonlinearity (required).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Clipping(name, upper, lower=None, input_spec=None, summary_labels=None)[source]

Clipping layer (specification key: clipping).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • upper (parameter, float) – Upper clipping value (required).
  • lower (parameter, float) – Lower clipping value (default: negative upper value).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Deltafier(name, concatenate=False, input_spec=None, summary_labels=None)[source]

Deltafier layer computing the difference between the current and the previous input; can only be used as preprocessing layer (specification key: deltafier).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • concatenate (False | int >= 0) – Whether to concatenate instead of replace deltas with input, and if so, concatenation axis (default: false).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Dropout(name, rate, input_spec=None, summary_labels=None)[source]

Dropout layer (specification key: dropout).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • rate (parameter, 0.0 <= float < 1.0) – Dropout rate (required).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Image(name, height=None, width=None, grayscale=False, input_spec=None, summary_labels=None)[source]

Image preprocessing layer (specification key: image).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • height (int) – Height of resized image (default: no resizing or relative to width).
  • width (int) – Width of resized image (default: no resizing or relative to height).
  • grayscale (bool | iter[float]) – Turn into grayscale image, optionally using given weights (default: false).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Reshape(name, shape, input_spec=None, summary_labels=None)[source]

Reshape layer (specification key: reshape).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • shape (int | iter[int]) – New shape (required).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Sequence(name, length, axis=-1, concatenate=True, input_spec=None, summary_labels=None)[source]

Sequence layer stacking the current and previous inputs; can only be used as preprocessing layer (specification key: sequence).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • length (int > 0) – Number of inputs to concatenate (required).
  • axis (int >= 0) – Concatenation axis, excluding batch axis (default: last axis).
  • concatenate (bool) – Whether to concatenate inputs at given axis, otherwise introduce new sequence axis (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).

Layers with internal states

class tensorforce.core.layers.InternalGru(name, size, length, bias=False, activation=None, dropout=0.0, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None, **kwargs)[source]

Internal state GRU cell layer (specification key: internal_gru).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • cell ('gru' | 'lstm') – The recurrent cell type (required).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • length (parameter, long > 0) – For truncated backpropagation through time (required).
  • bias (bool) – Whether to add a trainable bias variable (default: false).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (activation) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Activation nonlinearity (default: none).
  • dropout (parameter, 0.0 <= float < 1.0) – Dropout rate (default: 0.0).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
  • kwargs – Additional arguments for Keras GRU layer, see TensorFlow docs.
class tensorforce.core.layers.InternalLstm(name, size, length, bias=False, activation=None, dropout=0.0, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None, **kwargs)[source]

Internal state LSTM cell layer (specification key: internal_lstm).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • cell ('gru' | 'lstm') – The recurrent cell type (required).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • length (parameter, long > 0) – For truncated backpropagation through time (required).
  • bias (bool) – Whether to add a trainable bias variable (default: false).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (activation) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Activation nonlinearity (default: none).
  • dropout (parameter, 0.0 <= float < 1.0) – Dropout rate (default: 0.0).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
  • kwargs – Additional arguments for Keras LSTM layer, see TensorFlow docs.
class tensorforce.core.layers.InternalRnn(name, cell, size, length, bias=True, activation='tanh', dropout=0.0, is_trainable=True, input_spec=None, summary_labels=None, l2_regularization=None, **kwargs)[source]

Internal state RNN cell layer (specification key: internal_rnn).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • cell ('gru' | 'lstm') – The recurrent cell type (required).
  • size (int >= 0) – Layer output size, 0 implies additionally removing the axis (required).
  • length (parameter, long > 0) – For truncated backpropagation through time (required).
  • bias (bool) – Whether to add a trainable bias variable (default: true).
  • ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' | (activation) – ‘softmax’ | ‘softplus’ | ‘softsign’ | ‘swish’ | ‘tanh’): Activation nonlinearity (default: tanh).
  • dropout (parameter, 0.0 <= float < 1.0) – Dropout rate (default: 0.0).
  • is_trainable (bool) – Whether layer variables are trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
  • kwargs – Additional arguments for Keras RNN cell layer, see TensorFlow docs.

Special layers

class tensorforce.core.layers.Block(name, layers, input_spec=None)[source]

Block of layers (specification key: block).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • layers (iter[specification]) –

    Layers configuration, see layers (required).

  • input_spec (specification) – Input tensor specification (internal use).
class tensorforce.core.layers.Function(name, function, output_spec=None, input_spec=None, summary_labels=None, l2_regularization=None)[source]

Custom TensorFlow function layer (specification key: function).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • function (lambda[x -> x]) – TensorFlow function (required).
  • output_spec (specification) – Output tensor specification containing type and/or shape information (default: same as input).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
  • l2_regularization (float >= 0.0) – Scalar controlling L2 regularization (default: inherit value of parent module).
class tensorforce.core.layers.Keras(name, layer, input_spec=None, summary_labels=None, l2_regularization=None, **kwargs)[source]

Keras layer (specification key: keras).

Parameters:
class tensorforce.core.layers.Register(name, tensor, input_spec=None, summary_labels=None)[source]

Tensor retrieval layer, which is useful when defining more complex network architectures which do not follow the sequential layer-stack pattern, for instance, when handling multiple inputs (specification key: register).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • tensor (string) – Name under which tensor will be registered (required).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Retrieve(name, tensors, aggregation='concat', axis=0, input_spec=None, summary_labels=None)[source]

Tensor retrieval layer, which is useful when defining more complex network architectures which do not follow the sequential layer-stack pattern, for instance, when handling multiple inputs (specification key: retrieve).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • tensors (iter[string]) – Names of global tensors to retrieve, for instance, state names or previously registered global tensor names (required).
  • aggregation ('concat' | 'product' | 'stack' | 'sum') – Aggregation type in case of multiple tensors (default: ‘concat’).
  • axis (int >= 0) – Aggregation axis, excluding batch axis (default: 0).
  • input_spec (specification) – Input tensor specification (internal use).
  • summary_labels ('all' | iter[string]) – Labels of summaries to record (default: inherit value of parent module).
class tensorforce.core.layers.Reuse(name, layer, is_trainable=True, input_spec=None)[source]

Reuse layer (specification key: reuse).

Parameters:
  • name (string) – Layer name (default: internally chosen).
  • layer (string) – Name of a previously defined layer (required).
  • is_trainable (bool) – Whether reused layer variables are kept trainable (default: true).
  • input_spec (specification) – Input tensor specification (internal use).