mindchemistry.e3.nn.FullyConnectedNet
- class mindchemistry.e3.nn.FullyConnectedNet(h_list, act=None, out_act=False, init_method='normal', dtype=float32)[source]
- Fully-connected Neural Network with normalized activation on scalars. - Parameters
- h_list (List[int]) – a list of input, internal and output dimensions for dense layers. 
- act (Func) – activation function which will be automatically normalized. Default: - None.
- out_act (bool) – whether apply the activation function on the output. Default: - False.
- init_method (Union[str, mindspore.common.initializer]) – initialize parameters. Default: - 'normal'.
- dtype (mindspore.dtype) – The type of input tensor. Default: - mindspore.float32.
 
 - Inputs:
- input (Tensor) - The shape of Tensor is \((h\_list[0])\). 
 
- Outputs:
- output (Tensor) - The shape of Tensor is \((h\_list[-1])\). 
 
 - Raises
- TypeError – If the elements h_list are not int. 
 - Supported Platforms:
- Ascend
 - Examples - >>> import mindspore as ms >>> from mindchemistry.e3.nn import FullyConnectedNet >>> fc = FullyConnectedNet([4,10,20,12,6], ops.tanh) FullyConnectedNet [4, 10, 20, 12, 6] >>> v = ms.Tensor([.1,.2,.3,.4]) >>> grad = ops.grad(fc, weights=fc.trainable_params()) >>> fc(v).shape (6,) >>> [x.shape for x in grad(v)[1]] [(4, 10), (10, 20), (20, 12), (12, 6)]