Fonction torch.nextafter de PyTorch
Manuel de référence PyTorch torch
torch.nextafterest une fonction dans PyTorch utilisée pour renvoyer le prochain nombre à virgule flottante représentable élément par élément.
Définition de fonction
torch.nextafter(input, other, out=None)
Exemple d'utilisation
Exemple
import torch
# Renvoie le prochain nombre à virgule flottante représentable
x = torch.tensor([1.0, 2.0])
y = torch.tensor([2.0, 2.0])
result = torch.nextafter(x, y)
print(result)
# Renvoie le prochain nombre à virgule flottante représentable
x = torch.tensor([1.0, 2.0])
y = torch.tensor([2.0, 2.0])
result = torch.nextafter(x, y)
print(result)
Autres extensions