def build_lstm(input_var, output_nodes, n_chanels, input_size, reshaped_input_size, activity):
"""
Builds the complete network with 1D-conv1d layer to integrate time from sequences of EEG images.
:param input_vars: list of EEG images (one image per time window)
:param output_nodes: number of classes
:return: a pointer to the output of last layer
"""
# Input layer
network = InputLayer(shape=(None, 1, input_size), input_var=input_var)
network = ReshapeLayer(network, (([0], n_chanels, reshaped_input_size)))
network = LSTMLayer(network, num_units=8, nonlinearity=tanh)
network = LSTMLayer(network, num_units=1, nonlinearity=tanh)
network = DenseLayer(network, num_units=output_nodes, nonlinearity=activity)
return network
评论列表
文章目录