    def _log_distributions(self) -> None:
        """
        Log distributions of parameters.
        """
        if not self._distribution_parameters:
            # Avoiding calling this every batch.  If we ever use two separate models with a single
            # writer, this is wrong, but I doubt that will ever happen.
            self._distribution_parameters = set(
                self.trainer.model.get_parameters_for_histogram_logging()  # type: ignore[union-attr]
            )
        parameters_to_log: Dict[str, torch.Tensor] = {}
        for name, param in self.trainer.model.named_parameters():  # type: ignore[union-attr]
            if name in self._distribution_parameters:
                parameters_to_log[name] = param
        self.log_tensors(parameters_to_log, log_prefix="parameter_histogram")
Log distributions of parameters.
allennlp/training/callbacks/log_writer.py