twodlearn.core.layers module

Definition of tf.keras compatible Layers

The tdl Layer is compatible with tf.keras layers and supports autoinitialization with tdl descriptors.

class twodlearn.core.layers.Layer(trainable=True, name=None, *args, **kwargs)[source]

Bases: tensorflow.python.keras.engine.base_layer.Layer

TDL Layer that is compatible with tf.keras specification.

add_weight(*args, **kwargs)[source]

add a weight to the layer. If only one argument is provided, it should be an instance of tf.Variable. Otherwise, the signature is the same as tf.keras.Layer add_weight.

build(input_shape=None)[source]

Creates the variables of the layer (optional, for subclass implementers).

This is a method that implementers of subclasses of Layer or Model can override if they need a state-creation step in-between layer instantiation and layer call.

This is typically used to create the weights of Layer subclasses.

Parameters

input_shape – Instance of TensorShape, or list of instances of TensorShape if the layer expects a list of inputs (one instance per input).

input_shape[source]
property scope[source]

Scope for the model, used to define all operations.