Model¶
- class
dragon.vm.tensorlayer.models.
Model
(name=None)[source]¶ Compose a group of layers with training features.
__init__¶
Properties¶
all_layers¶
Model.
all_layers
¶Return all the layers in this model.
- Returns:
- Sequence[dragon.vm.tensorlayer.layers.Layer] – The layer sequence.
all_weights¶
Model.
all_weights
¶Return all the weights, both trainable and non-trainable.
- Returns:
- Sequence[dragon.Tensor] – The weights sequence.
nontrainable_weights¶
Module.
nontrainable_weights
Return the non-trainable weights.
- Returns:
- Sequence[dragon.Tensor] – The weights sequence.
trainable_weights¶
Module.
trainable_weights
Return the trainable weights.
- Returns:
- Sequence[dragon.Tensor] – The weights sequence.
training¶
Module.
training
Return the training mode.
- Returns:
- bool –
True
for training otherwise evaluation.
Methods¶
add_weight¶
Module.
add_weight
(
name=None,
shape=None,
init='glorot_uniform',
trainable=True
)[source]Add a new weight.
- Parameters:
- name (str, optional) – The weight name.
- shape (Sequence[int], optional) – The weight shape.
- init (Union[callable, str], optional) – The initializer for weight.
- trainable (bool, optional, default=True) –
True
to compute the gradients if necessary.
- Returns:
dragon.Tensor – The weight tensor.
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.