def test_box_gaussian_generic(): """ Run generic tests for BoxGaussian. """ dist = BoxGaussian(np.array([[-3, 7, 1], [1, 2, 3]]), np.array([[5, 7.1, 3], [2, 3.1, 4]])) tester = DistributionTester(dist) tester.test_all()
def test_generic(self): """ Run generic tests with DistributionTester. """ dist = BoxGaussian(np.array([[-3, 7, 1], [1, 2, 3]]), np.array([[5, 7.1, 3], [2, 3.1, 4]])) tester = DistributionTester(self, dist) tester.test_all()
def test_tuple_generic(): """ Run generic tests for TupleDistribution. """ box_dist = BoxGaussian(np.array([[-3, 7, 1], [1, 2, 3.7]]), np.array([[5, 7.1, 1.5], [2, 2.5, 4]])) dist = TupleDistribution((MultiBernoulli(3), box_dist)) tester = DistributionTester(dist) tester.test_all()
def test_tuple_unpack_shape(): """ Make sure that TupleDistribution.unpack_outs() gives the correct shape. """ box_dist = BoxGaussian(np.array([[-3, 7, 1], [1, 2, 3.7]]), np.array([[5, 7.1, 1.5], [2, 2.5, 4]])) dist = TupleDistribution((MultiBernoulli(3), box_dist)) vec = np.array([[0, 1, 0, 1, 2, 3, 4, 5, 6], [1, 0, 1, 6, 5, 4, 3, 2, 1]]) unpacked = dist.unpack_outs(vec) assert len(unpacked) == 2 assert np.array(unpacked[0]).shape == (2, 3) assert np.array(unpacked[1]).shape == (2, 2, 3)
def test_unpack_shape(self): """ Make sure that unpack_outs gives the correct shape. """ box_dist = BoxGaussian(np.array([[-3, 7, 1], [1, 2, 3.7]]), np.array([[5, 7.1, 1.5], [2, 2.5, 4]])) dist = TupleDistribution((MultiBernoulli(3), box_dist)) vec = np.array([[0, 1, 0, 1, 2, 3, 4, 5, 6], [1, 0, 1, 6, 5, 4, 3, 2, 1]]) unpacked = dist.unpack_outs(vec) self.assertEqual(len(unpacked), 2) self.assertEqual(np.array(unpacked[0]).shape, (2, 3)) self.assertEqual(np.array(unpacked[1]).shape, (2, 2, 3))