Source code for UQpy.scientific_machine_learning.baseclass.Layer
import torch
import torch.nn as nn
from abc import ABC, abstractmethod
[docs]class Layer(nn.Module, ABC):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def reset_parameters(self, a, b):
"""Fill all parameters with samples from :math:`\mathcal{U}(a, b)`"""
for p in self.parameters():
nn.init.uniform_(p, a, b)