network_arch module
- class network_arch.MyNet(size_list, activation_name, d_out)
Bases:
torch.nn.modules.module.Module
List of
network_arch.MySequential
neural networks. The ith entry is used to store the ith eigenfunction.- Parameters
size_list (list) – number of neurons for each layer. Each neural network has the same size_list.
activation_name (string) – name of the non-linear activation function.
d_out (int) – number of neural networks in the list.
- feature_forward(xf)
Map the input feature xf to list of output tensors. For each neural network in the list, it simply calls
network_arch.MySequential.feature_forward()
function.- Parameters
xf (torch tensor) – input feature
- forward(x)
Map the input data set x to list of output tensors. For each neural network in the list, it simply calls
network_arch.MySequential.forward()
function.- Parameters
x (
data_set.data_set
) – input data set
- shift_and_normalize(mean_list, var_list)
For each neural networks in the list, substract and divide the function by the values specified in the mean_list and var_list. It simply calls the function
network_arch.MySequential.shift_and_normalize()
.- Parameters
mean_list (list of double) – list of mean values.
var_list (list of positive double) – list of variances.
- training: bool
- class network_arch.MySequential(size_list, activation_name)
Bases:
torch.nn.modules.module.Module
This class implements a feedforward neural network.
- Parameters
size_list (list) – number of neurons for each layer.
activation_name (string) – name of activation function. It should match one of the names of non-linear activations functions for PyTorch.
- feature_forward(xf)
Map the feature to output tensor by the neural network.
- Parameters
xf (torch tensor) – input feature.
- forward(x)
Map the input data set to feature according to feature map, and then to output tensor by the neural network.
- Parameters
x (
data_set.data_set
) – input data set- Returns
output tensor
- Return type
torch tensor
- shift_and_normalize(mean, var)
Substract the neural network function by mean and divide it by \(\sqrt{var}\). This is achieved by modifying parameters of the neural network.
- training: bool