parameters: (self, net)
docstring: Collect kl loss of each Bayesian layer.
docstring_summary: Collect kl loss of each Bayesian layer.
docstring_tokens: Collect kl loss of each Bayesian layer .
function: def _add_kl_loss(self, net):
          """Collect kl loss of each Bayesian layer."""
          for (_, layer) in net.name_cells().items():
              if isinstance(layer, (_DenseVariational, _ConvVariational)):
                  self.kl_loss.append(layer.compute_kl_loss)
              else:
                  self._add_kl_loss(layer)
function_tokens: def _add_kl_loss ( self , net ) : for ( _ , layer ) in net . name_cells ( ) . items ( ) : if isinstance ( layer , ( _DenseVariational , _ConvVariational ) ) : self . kl_loss . append ( layer . compute_kl_loss ) else : self . _add_kl_loss ( layer )