megnet.layers.graph.schnet module¶
Schnet implementation
- class InteractionLayer(*args, **kwargs)[source]¶
Bases:
megnet.layers.graph.base.GraphNetworkLayer
The Continuous filter InteractionLayer in Schnet
Schütt et al. SchNet: A continuous-filter convolutional neural network for modeling quantum interactions
- call(inputs, mask=None)¶
the logic of the layer, returns the final graph
- compute_output_shape(input_shape)[source]¶
compute static output shapes, returns list of tuple shapes
- phi_v(b_e_p, inputs)[source]¶
update the atom attributes by the results from previous step b_e_p and all the inputs returns v_p.
- Parameters
activation (str) – Default: None. The activation function used for each sub-neural network. Examples include ‘relu’, ‘softmax’, ‘tanh’, ‘sigmoid’ and etc.
use_bias (bool) – Default: True. Whether to use the bias term in the neural network.
kernel_initializer (str) – Default: ‘glorot_uniform’. Initialization function for the layer kernel weights,
bias_initializer (str) – Default: ‘zeros’
activity_regularizer (str) – Default: None. The regularization function for the output
kernel_constraint (str) – Default: None. Keras constraint for kernel values
bias_constraint (str) – Default: None .Keras constraint for bias values
- build(input_shapes)[source]¶
Build the weights for the layer :param input_shapes: the shapes of all input tensors :type input_shapes: sequence of tuple
- 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
- phi_e(inputs)[source]¶
Edge update function :param inputs: :type inputs: tuple of tensor
- Returns
output tensor
- phi_u(b_e_p, b_v_p, inputs)[source]¶
- Parameters
b_e_p (tf.Tensor) – edge/bond to global aggregated tensor
b_v_p (tf.Tensor) – node/atom to global aggregated tensor
inputs (Sequence) – list or tuple for the graph inputs
- Returns
updated globa/state attributes
- phi_v(b_ei_p, inputs)[source]¶
Node update function :param b_ei_p: edge aggregated tensor :type b_ei_p: tensor :param inputs: other graph inputs :type inputs: tuple of tensors
Returns: updated node tensor
- rho_e_u(e_p, inputs)[source]¶
aggregate edge to state :param e_p: edge tensor :type e_p: tensor :param inputs: other graph input tensors :type inputs: tuple of tensors
Returns: edge aggregated tensor for states