tyxe/priors.py
def apply_(self, net):
        """"Replaces all nn.Parameter attributes on a given PyroModule net according to the hide/expose logic and
        the classes' prior_dist method."""
        for module_name, module in net.named_modules():
            for param_name, param in list(module.named_parameters(recurse=False)):
                full_name = module_name + "." + param_name
                if self.expose_fn(module, full_name):
                    prior_dist = self.prior_dist(full_name, module, param).expand(param.shape).to_event(param.dim())
                    setattr(module, param_name, PyroSample(prior_dist))
                else:
                    setattr(module, param_name, PyroParam(param.data.detach()))
Replaces all nn.Parameter attributes on a given PyroModule net according to the hide/expose logic and
        the classes' prior_dist method.
Replaces all nn.Parameter attributes on a given PyroModule net according to the hide/expose logic and
the classes' prior_dist method.
Replaces all nn . Parameter attributes on a given PyroModule net according to the hide / expose logic and the classes ' prior_dist method .
def apply_(self, net):
        for module_name, module in net.named_modules():
            for param_name, param in list(module.named_parameters(recurse=False)):
                full_name = module_name + "." + param_name
                if self.expose_fn(module, full_name):
                    prior_dist = self.prior_dist(full_name, module, param).expand(param.shape).to_event(param.dim())
                    setattr(module, param_name, PyroSample(prior_dist))
                else:
                    setattr(module, param_name, PyroParam(param.data.detach()))
def apply_ ( self , net ) : for module_name , module in net . named_modules ( ) : for param_name , param in list ( module . named_parameters ( recurse = False ) ) : full_name = module_name + "." + param_name if self . expose_fn ( module , full_name ) : prior_dist = self . prior_dist ( full_name , module , param ) . expand ( param . shape ) . to_event ( param . dim ( ) ) setattr ( module , param_name , PyroSample ( prior_dist ) ) else : setattr ( module , param_name , PyroParam ( param . data . detach ( ) ) )
Replaces all nn.Parameter attributes on a given PyroModule net according to the hide/expose logic and
the classes' prior_dist method.
Replaces all nn . Parameter attributes on a given PyroModule net according to the hide / expose logic and the classes ' prior_dist method .
""""Replaces all nn.Parameter attributes on a given PyroModule net according to the hide/expose logic and
        the classes' prior_dist method."""
self
net