spyrit.core.prep.SplitPoisson.denormalize_expe

SplitPoisson.denormalize_expe(x: tensor, beta: tensor, h: int = None, w: int = None) tensor

Denormalize images from the range [-1;1] to the range [0; \(\beta\)]

It computes \(m = \frac{\beta}{2}(x+1)\), where \(\beta\) is the normalization factor, that can be different for each image in the batch.

Args:
  • x (torch.tensor): Batch of images

  • beta (torch.tensor): Normalization factor. It should have

the same shape as the batch. - h (int, optional): Image height. If None, it is deduced from the shape of x. Defaults to None. - w (int): Image width. If None, it is deduced from the shape of x. Defaults to None.

Shape:
  • x: \((*, h, w)\) where \(*\) indicates any batch

dimensions - beta: \((*)\) or \((1)\) if the same for all images - h: int - w: int - Output: \((*, h, w)\)

Example:
>>> x = torch.rand([10, 1, 32,32], dtype=torch.float)
>>> beta = 9*torch.rand([10])
>>> y = split_op.denormalize_expe(x, beta, 32, 32)
>>> print(y.shape)
torch.Size([10, 1, 32, 32])