Keraflow
Deep Learning for Python.
 All Classes Namespaces Functions Pages
keraflow.layers.wrappers.TimeDistributed Class Reference

Wrapper for apply a layer to every temporal slice of an input. More...

Inheritance diagram for keraflow.layers.wrappers.TimeDistributed:
keraflow.layers.base.Layer

Public Member Functions

def __init__
 
- Public Member Functions inherited from keraflow.layers.base.Layer
def __init__
 
def set_trainable_params
 Register the layer's trainable parameters. More...
 
def input_dimension
 Return the expected dimension of input tensor. More...
 
def check_input_shape
 Check if the input shape(s) are valid. More...
 
def init_param
 Initializes trainable parameter(s) of the layer. More...
 
def output
 Calculates the output tensor of the layer given the input tensor(s). More...
 
def output_shape
 Calculates the shape of the output tensor given the shape of the input tensor(s). More...
 
def support_mask
 Whether the layer supports to carry on to the output tensor the mask embedded in input tensor. More...
 
def pack_init_param
 Check keraflow.utils.generic_utils.serialize.
 
def get_tensor_shape
 Get the shape of a tensor. More...
 
def get_weights
 Gets trainable parameter name, value (numpy arrays) pairs. More...
 
def embed
 Embeds the target layer such that its trainable parameters (along with regularizers and constraints on the parameters) are treated as the host layer's parameters and are updated during traing process. More...
 
def __call__
 Feed an input kensor or multiple input kensors to the layer and outputs another Kensor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from keraflow.layers.base.Layer
def unpack_init_param
 Check keraflow.utils.generic_utils.unserialize. More...
 

Detailed Description

Wrapper for apply a layer to every temporal slice of an input.

The input should be at least 3D. The first dimension is the batch dimension, and the second dimension is considered to be the temporal dimension.

Example of applying a dens layer to the output of an Embedding layer:

1 vocabulary_size = 5000
2 emb_dim = 50
3 model = Sequential()
4 model.add(Input(None, batch_size=32)) # variable length of inputs
5 model.add(Embedding(vocabulary_size, emb_dim)) # output will be of shape (batch_size, sequence_length, emb_dim)
6 model.add(TimeDistributed(Dense(32))) # output will be of shape (batch_size, sequence_length, 32)

Constructor & Destructor Documentation

def keraflow.layers.wrappers.TimeDistributed.__init__ (   self,
  layer,
  kwargs 
)
Parameters
layerThe layer to be wrapped.
kwargssee Layer.__init__.