mindchemistry.e3.nn.Activation
- class mindchemistry.e3.nn.Activation(irreps_in, acts, dtype=float32)[source]
Activation function for scalar-tensors. The parities of irreps may be changed according to the parity of each activation functions. Odd scalars require the corresponding activation functions to be odd or even.
- Parameters
acts (List[Func]) – a list of activation functions for each part of irreps_in. The length of the acts will be clipped or filled by identity functions to match the length of irreps_in.
dtype (mindspore.dtype) – The type of 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 contain non-scalar irrep.
ValueError – If a irrep in irreps_in is odd, but the corresponding activation function is neither even nor odd.
- Supported Platforms:
Ascend
Examples
>>> from mindchemistry.e3.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)