LayerList

class dragon.vm.tensorlayer.layers.LayerList(
  layers,
  name=None
)[source]

The sequential layer to stack a group of layers.

__init__

LayerList.__init__(
  layers,
  name=None
)[source]

Create a new LayerList.

Parameters:

Properties

all_weights

LayerList.all_weights

Return all the weights, both trainable and non-trainable.

Returns:
Sequence[dragon.Tensor] – The weights sequence.

name

LayerList.name

Return the layer name.

Returns:
str – The layer name.

nontrainable_weights

LayerList.nontrainable_weights

Return the non-trainable weights.

Returns:
Sequence[dragon.Tensor] – The weights sequence.

trainable_weights

LayerList.trainable_weights

Return the trainable weights.

Returns:
Sequence[dragon.Tensor] – The weights sequence.

training

LayerList.training

Return the training mode.

Returns:
boolTrue for training otherwise evaluation.

Methods

forward

LayerList.forward(
  inputs,
  *args,
  **kwargs
)[source]

Forward the computation sequentially.

Parameters:
Returns:

Sequence[dragon.Tensor] – The outputs.

load_weights

Module.load_weights(
  filepath,
  format=None,
  skip=False,
  verbose=False
)[source]

Load model weights from a binary file.

Parameters:
  • filepath (str) – The path of weights file.
  • format ({'hdf5', 'npz', 'pkl', 'npz_dict'}, optional) – The optional saving format.
  • skip (bool, optional, default=False) – True to skip the modules which is not found.
  • verbose (bool, optional, default=False) – True to print the matched weights.

save_weights

Module.save_weights(
  filepath,
  format=None
)[source]

Save weights into a binary file.

Parameters:
  • filepath (str) – The path of weights file.
  • format ({'hdf5', 'npz', 'pkl', 'npz_dict'}, optional) – The optional saving format.

__getitem__

LayerList.__getitem__(idx)[source]

Return the specified layer selected by index.

Parameters:
  • idx (int) – The layer index in the sequence.
Returns:

dragon.vm.tensorlayer.layers.Layer – The layer instance.

__len__

LayerList.__len__()[source]

Return the number of sequential layers.

Returns:
int – The number of layers.