twodlearn.stacked module

class twodlearn.stacked.StackedLayers(trainable=True, name=None, *args, **kwargs)[source]

Bases: twodlearn.core.layers.Layer

Layer that is composed of several stacked layers.

Tdl autoinitialization with arguments:

input_shape[source]

(InputArgument) Input tensor shape.

layers[source]

(Submodel) Layers that are executed sequentially.

add(layer)[source]

Add a new layer to the stacked model. The only condition is that layer must be callable.

build(input_shape=None)[source]

Build the model. Note that this function does not build the layers.

call(inputs, *args, **kargs)[source]

Call the layers in sequential order.

compute_output_shape(input_shape=None)[source]

Computes the output shape of the layer.

Assumes that the layer will be built to match that input shape provided.

Parameters

input_shape – Shape tuple (tuple of integers) or list of shape tuples (one per output tensor of the layer). Shape tuples can include None for free dimensions, instead of an integer.

Returns

An input shape tuple.

input_shape[source]

Input tensor shape.

layers[source]

Layers that are executed sequentially.

class twodlearn.stacked.StackedModel(layers=None, return_layers=None, options=None, name='Stacked')[source]

Bases: twodlearn.core.common.TdlModel

class StackedOutput(**kargs)[source]

Bases: twodlearn.core.common.OutputModel

add(layer)[source]
evaluate(*args, **kargs)[source]
get_save_data()[source]
layers[source]
regularizer[source]

Decorator used to specify a regularizer for a model. The decorator works similar to @property, but the specified method correponds to the initialization of the regularizer.

return_layers[source]

True if the return value of the stacked model is the layers