code: def test_half_normal_prior_batch_log_prob(self, cuda=False):
      device = torch.device("cuda") if cuda else torch.device("cpu")
      prior = HalfNormalPrior(1.0)
      dist = HalfNormal(1.0)
      t = torch.ones(2, device=device)
      self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
      t = torch.ones(2, 2, device=device)
      self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
  
      scale = torch.tensor([1.0, 10.0], device=device)
      prior = HalfNormalPrior(scale)
      dist = HalfNormal(scale)
      t = torch.ones(2, device=device)
      self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
      t = torch.ones(2, 2, device=device)
      self.assertTrue(torch.equal(prior.log_prob(t), dist.log_prob(t)))
      with self.assertRaises(ValueError):
          prior.log_prob(torch.ones(3, device=device))
      with self.assertRaises(ValueError):
          prior.log_prob(torch.ones(2, 3, device=device))
  
file_path: gpytorch/test/priors/test_half_normal_prior.py
imports: import unittest
  import torch
  from torch.distributions import HalfNormal
  from gpytorch.priors import HalfNormalPrior
  from gpytorch.test.utils import least_used_cuda_device
label_desc: Use image node_id 7 for calling the TestHalfNormalPrior obj's underlying member method code with example usage: obj.test_half_normal_prior_batch_log_prob(cuda) without return types