def test_initialize_power_batch(self): kernel = LinearTruncatedFidelityKernel(batch_shape=torch.Size([2])) power_init = torch.tensor([1, 2], dtype=torch.float) kernel.initialize(power=power_init) actual_value = power_init.view_as(kernel.power) self.assertLess(torch.norm(kernel.power - actual_value), 1e-5)
def test_initialize_power(self): kernel = LinearTruncatedFidelityKernel() kernel.initialize(power=1) actual_value = torch.tensor(1, dtype=torch.float).view_as(kernel.power) self.assertLess(torch.norm(kernel.power - actual_value), 1e-5)