megnet.layers.readout.set2set module

Set2Set implementation

class Set2Set(*args, **kwargs)[source]

Bases: keras.engine.base_layer.Layer

For a set of vectors, the set2set neural network maps it to a single vector. The order invariance is acheived by a attention mechanism. See Vinyals, Oriol, Samy Bengio, and Manjunath Kudlur. “Order matters: Sequence to sequence for sets.” arXiv preprint arXiv:1511.06391 (2015).

Parameters
  • T – (int) recurrent step

  • n_hidden – (int) number of hidden units

  • activation – (str or object) activation function

  • activation_lstm – (str or object) activation function for lstm

  • recurrent_activation – (str or object) activation function for recurrent step

  • kernel_initializer – (str or object) initializer for kernel weights

  • recurrent_initializer – (str or object) initializer for recurrent weights

  • bias_initializer – (str or object) initializer for biases

  • use_bias – (bool) whether to use biases

  • unit_forget_bias – (bool) whether to use basis in forget gate

  • kernel_regularizer – (str or object) regularizer for kernel weights

  • recurrent_regularizer – (str or object) regularizer for recurrent weights

  • bias_regularizer – (str or object) regularizer for biases

  • kernel_constraint – (str or object) constraint for kernel weights

  • recurrent_constraint – (str or object) constraint for recurrent weights

  • bias_constraint – (str or object) constraint for biases

  • kwargs – other inputs for keras Layer class

build(input_shape)[source]

Build tensors :param input_shape: input shapes :type input_shape: sequence of tuple

call(inputs, mask=None)[source]

Main logic :param inputs: input tensors :type inputs: tuple of tensor :param mask: mask tensor :type mask: tensor

Returns: output tensor

compute_output_shape(input_shape)[source]

Compute output shapes from input shapes :param input_shape: input shapes :type input_shape: sequence of tuple

Returns: sequence of tuples output shapes

get_config()[source]

Part of keras layer interface, where the signature is converted into a dict

Returns

configurational dictionary