mindscience.e3nn.nn.Activation

class mindscience.e3nn.nn.Activation(irreps_in, acts, dtype=mindspore.float32)[source]

Activation function for scalar irreps (\(l = 0\)). The parity of each irrep may change depending on whether the corresponding activation function is even or odd. Even scalars (0e) keep their parity; odd scalars (0o) flip to even (0e) when an even activation is applied and remain odd (0o) only if an odd activation is used.

Parameters
  • irreps_in (Union[str, Irrep, Irreps]) – The input irreps.

  • acts (list[Func]) – A list of activation functions for each part of irreps_in. The length of acts will be clipped or filled with identity functions to match the length of irreps_in.

  • dtype (mindspore.dtype, optional) – The data type of the input tensor. Default: mindspore.float32.

Inputs:
  • inputs (Tensor) - The shape of Tensor is \((*, irreps\_in.dim)\).

Outputs:
  • outputs (Tensor) - The shape of Tensor is \((*, irreps\_in.dim)\).

Raises
  • ValueError – If irreps_in contains non-scalar irrep.

  • ValueError – If a irrep in irreps_in is odd, but the corresponding activation function is neither even nor odd.

Examples

>>> from mindscience.e3nn.nn import Activation
>>> from mindspore import ops, Tensor
>>> act = Activation('3x0o+2x0e+1x0o', [ops.abs, ops.tanh])
>>> print(act)
Activation [xx-] (3x0o+2x0e+1x0o -> 3x0e+2x0e+1x0o)
>>> inputs = Tensor(ops.ones((4,6)))
>>> outputs = act(inputs)
>>> print(outputs.shape)
(4, 6)