Fonction torch.float_power de PyTorch
Manuel de référence Pytorch torch
torch.float_powerest une fonction de PyTorch utilisée pour les opérations de puissance en virgule flottante élément par élément.
Définition de fonction
torch.float_power(input, exponent, *, out=None)
Exemple d'utilisation
Exemple
import torch
# Exemple d'opération de puissance en virgule flottante
x = torch.tensor([2.0, 3.0, 4.0])
y = torch.tensor([2.0, 2.0, 2.0])
result = torch.float_power(x, y)
print(result) # tensor([4., 9., 16.])
# Exemple d'opération de puissance en virgule flottante
x = torch.tensor([2.0, 3.0, 4.0])
y = torch.tensor([2.0, 2.0, 2.0])
result = torch.float_power(x, y)
print(result) # tensor([4., 9., 16.])
Autres extensions