spyrit.core.torch.ifwht_2d
- spyrit.core.torch.ifwht_2d(x, order=True)[source]
Returns the inverse fast Walsh-Hadamard transform of a 2D tensor.
This function uses the inverse fast Walsh-Hadamard transform for 1D signals. It is optimized for the natural order (with order = False) and the sequency order (with order = True). In case a list is provided in
order, it performs a permutation using the indices provided in the list. The inverse fast Walsh-Hadamard transform is applied along the last two dimensions of the input tensor.- Args:
x(torch.tensor): input tensor to transform. Must have shape \((*, h, w)\) where \(h\) and \(w\) are the height and width of the image and should be powers of two. \(*\) represents zero or more batch dimensions.order(bool or list, optional): Whether to use the sequency/Walsh ordering (True) or the natural ordering (False). If a list, it defines the permutation indices to use. Default is True.- Raises:
ValueError: If either of the last two dimensions of the input tensor is not a power of two.
- Returns:
torch.tensor: 2D inverse Walsh-Hadamard transformed tensor. Has the same shape as the input tensor.