YouTip LogoYouTip

Pytorch Torch Conj_Physical

PyTorch torch.conj_physical Function | Rookie Tutorial

Rookie Tutorial -- Learning not just technology, but dreams!

PyTorch Tutorial

PyTorch Tutorial PyTorch Introduction PyTorch Installation PyTorch Basics PyTorch Tensor PyTorch Neural Network Basics PyTorch First Neural Network PyTorch Data Processing and Loading PyTorch Linear Regression PyTorch Convolutional Neural Network PyTorch Recurrent Neural Network PyTorch Datasets PyTorch Data Transforms Pytorch torch Reference Manual PyTorch torch.nn Reference Manual Transformer Model PyTorch Building Transformer Model PyTorch torch.optim Optimizer Module PyTorch torchvision Computer Vision Module PyTorch Model Deployment PyTorch Model Save and Load PyTorch Example – Image Classification Project PyTorch Example – Text Sentiment Analysis Project PyTorch Autograd Automatic Differentiation PyTorch GPU / CUDA Acceleration PyTorch Loss Functions PyTorch Learning Rate Scheduler PyTorch Transfer Learning PyTorch Batch Normalization and Dropout PyTorch LSTM / GRU PyTorch Embedding (Embedding) PyTorch Generative Adversarial Network (GAN) PyTorch Autoencoder (Autoencoder) PyTorch Model Evaluation and Debugging PyTorch torchtext PyTorch Mixed Precision Training (AMP) PyTorch TorchScript/ONNX Export PyTorch Distributed Training PyTorch Attention Mechanism

PyTorch torch.conj_physical Function

The torch.conj_physical function returns the complex conjugate of a tensor with complex data type. It is equivalent to calling torch.conj().

Syntax

torch.conj_physical(input, *, out=None)

Parameters

  • input: The input tensor with complex data type.
  • out (optional): Output tensor.

Returns

A tensor containing the complex conjugate of the input tensor.

Example

import torch

# Create a complex tensor
x = torch.tensor([1+2j, 3+4j, 5+6j])
print("Original tensor:", x)

# Apply conj_physical
result = torch.conj_physical(x)
print("Conjugate tensor:", result)

Output

Original tensor: tensor([1.+2.j, 3.+4.j, 5.+6.j])
Conjugate tensor: tensor([1.-2.j, 3.-4.j, 5.-6.j])

Notes

  • This function only works on tensors with complex data types (e.g., torch.complex64, torch.complex128).
  • If the input tensor is real, this function will return the same tensor without any change.
  • For backward compatibility, torch.conj_physical() behaves identically to torch.conj().
← Pytorch Torch CorrcoefPytorch Torch Concat β†’