Fonction torch.bitwise_and de PyTorch
Manuel de référence PyTorch torch
torch.bitwise_andIl s'agit d'une fonction dans PyTorch utilisée pour effectuer un AND bit à bit élément par élément.
Définition de fonction
torch.bitwise_and(input, other, *, out=None)
Exemple d'utilisation
Exemple
import torch
# Exemple de AND bit à bit
x = torch.tensor([5, 3, 7], dtype=torch.int8)
y = torch.tensor([1, 3, 4], dtype=torch.int8)
result = torch.bitwise_and(x, y)
print(result) # tensor([1, 3, 4], dtype=int8)
# Exemple de AND bit à bit
x = torch.tensor([5, 3, 7], dtype=torch.int8)
y = torch.tensor([1, 3, 4], dtype=torch.int8)
result = torch.bitwise_and(x, y)
print(result) # tensor([1, 3, 4], dtype=int8)
Autres extensions