gossipy.model module#

Submodules#

Module contents#

This module provides a series of classes to handle the models.

class gossipy.model.TorchModel(*args, **kwargs)#

Bases: torch.nn.modules.module.Module, gossipy.Sizeable, abc.ABC

Abstract class for a torch model.

TorchModel is an abstract class that wraps a torch module and provide an interface to easily access the number of parameters of the module as well as to easily initialize the weights.

get_params_list()#

Returns a list of the parameters of the model as a torch.nn.ParameterList.

Returns

A list of the parameters of the model.

Return type

torch.nn.ParameterList

get_size()#

Returns the number of parameters of the model.

Returns

The number of parameters of the model.

Return type

int

abstract init_weights(*args, **kwargs)#

Initialize the weights of the model.

Return type

None