learning.as_real#
- bartorch.learning.as_real()#
Stack the real and imaginary parts of
inputalong a new leading axis.The channel-first counterpart of
torch.view_as_real(), as convolutional networks andtorchio.ScalarImagetake channels.- Parameters:
input (torch.Tensor) – Complex, of any shape. A real tensor is given a zero imaginary part.
- Returns:
Real, of shape
(2, *input.shape).- Return type:
torch.Tensor
Notes
torchio.ScalarImagetakes four axes,(channels, x, y, z), so a two-dimensional image is given a trailing axis of length one first.Examples
>>> volume = learning.as_real(image) # (2, x, y, z) >>> subject = torchio.Subject(image=torchio.ScalarImage(tensor=volume))