rofunc.learning.RofuncRL.models.utils#

1.  Module Contents#

1.1.  Functions#

build_mlp

Build multi-Layer perceptron :param dims: layer dimensions, including input and output layers :param hidden_activation: activation function for hidden layers :param output_activation: activation function for output layer :return:

build_cnn

Build convolutional neural network :param dims: layer dimensions, including input and output layers :param kernel_size: kernel size for convolutional layers :param stride: stride controls the stride for the cross-correlation :param padding: padding controls the amount of padding applied to the input :param dilation: dilation controls the spacing between the kernel points :param hidden_activation: activation function for hidden layers :param output_activation: activation function for output layer :param pooling: pooling layer type, [‘max’, ‘avg’, ‘none’] :param pooling_args: pooling layer arguments

activation_func

init_layers

get_space_dim

1.2.  API#

rofunc.learning.RofuncRL.models.utils.build_mlp(dims: [int], hidden_activation: torch.nn = nn.ReLU, output_activation: torch.nn = None) torch.nn.Sequential[source]#

Build multi-Layer perceptron :param dims: layer dimensions, including input and output layers :param hidden_activation: activation function for hidden layers :param output_activation: activation function for output layer :return:

rofunc.learning.RofuncRL.models.utils.build_cnn(dims: [int], kernel_size: Union[int, tuple, List], stride: Union[int, tuple, List] = 1, padding: Union[int, tuple, List] = 0, dilation: Union[int, tuple, List] = 1, hidden_activation: torch.nn = nn.ReLU, output_activation: torch.nn = None, pooling=None, pooling_args: dict = None) torch.nn.Sequential[source]#

Build convolutional neural network :param dims: layer dimensions, including input and output layers :param kernel_size: kernel size for convolutional layers :param stride: stride controls the stride for the cross-correlation :param padding: padding controls the amount of padding applied to the input :param dilation: dilation controls the spacing between the kernel points :param hidden_activation: activation function for hidden layers :param output_activation: activation function for output layer :param pooling: pooling layer type, [‘max’, ‘avg’, ‘none’] :param pooling_args: pooling layer arguments

The parameters kernel_size, stride, padding, dilation can either be: - a single int: in which case the same value is used for the height and width dimension - a tuple of two ints: in which case, the first int is used for the height dimension, and the second int for the width dimension :return:

rofunc.learning.RofuncRL.models.utils.activation_func(activation: str) torch.nn[source]#
rofunc.learning.RofuncRL.models.utils.init_layers(layers, gain=1.0, bias_const=1e-06, init_type='orthogonal')[source]#
rofunc.learning.RofuncRL.models.utils.get_space_dim(space)[source]#