A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.pytorch.org/docs/stable/generated/torch.view_as_real.html below:

torch.view_as_real — PyTorch 2.8 documentation

Returns a view of input as a real tensor. For an input complex tensor of size m 1 , m 2 , … , m i m1, m2, \dots, mi m1,m2,,mi, this function returns a new real tensor of size m 1 , m 2 , … , m i , 2 m1, m2, \dots, mi, 2 m1,m2,,mi,2, where the last dimension of size 2 represents the real and imaginary components of complex numbers.

Warning

view_as_real() is only supported for tensors with complex dtypes.

Parameters

input (Tensor) – the input tensor.

Example:

>>> x=torch.randn(4, dtype=torch.cfloat)
>>> x
tensor([(0.4737-0.3839j), (-0.2098-0.6699j), (0.3470-0.9451j), (-0.5174-1.3136j)])
>>> torch.view_as_real(x)
tensor([[ 0.4737, -0.3839],
        [-0.2098, -0.6699],
        [ 0.3470, -0.9451],
        [-0.5174, -1.3136]])

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4