Esempio n. 1
0
 def testCreateDataset(self):
     """Checks that creating a dataset works."""
     # Technically this is private functionality, but we don't have it tested
     # elsewhere.
     model = plasma_spectroscopy.PlasmaSpectroscopy(**_test_dataset())
     model2 = plasma_spectroscopy.PlasmaSpectroscopy(
         **model._sample_dataset(tfp_test_util.test_seed())[1])
     self.validate_log_prob_and_transforms(
         model2,
         sample_transformation_shapes=dict(identity=model.dtype._replace(
             amplitude=[16],
             temperature=[16],
             velocity=[16],
             shift=[],
         )))
Esempio n. 2
0
    def testBasic(self, use_bump_function):
        """Checks that you get finite values given unconstrained samples.

    We check `unnormalized_log_prob` as well as the values of the sample
    transformations.

    Args:
      use_bump_function: Whether to use the bump function.
    """
        model = plasma_spectroscopy.PlasmaSpectroscopy(
            **_test_dataset(), use_bump_function=use_bump_function)
        self.validate_log_prob_and_transforms(
            model,
            sample_transformation_shapes=dict(identity=model.dtype._replace(
                amplitude=[16],
                temperature=[16],
                velocity=[16],
                shift=[],
            )))