xnn.common.models.ops.init_linear_#
- xnn.common.models.ops.init_linear_(linear, weight='xavier_uniform')[source]#
Initialize a dense layer by name: its weight by
weight, its bias to zero.- Parameters:
linear (torch.nn.Linear) – The layer, modified in place.
weight (str, optional) – A name of
WEIGHT_INITS, by default"xavier_uniform";"torch"keeps PyTorch’s initialization of weight and bias.
- Returns:
linear.- Return type:
- Raises:
ValueError – For an unknown name.