Fonction PyTorch torch.bmm
Manuel de référence Pytorch torch
torch.bmmest une fonction de PyTorch utilisée pour effectuer une multiplication matricielle par lots.
Définition de fonction
torch.bmm(input, mat2, out)
Exemple d'utilisation
Exemple
import torch
# Multiplication matricielle par lots
batch_a = torch.randn(10, 3, 4)
batch_b = torch.randn(10, 4, 5)
result = torch.bmm(batch_a, batch_b)
print("Forme du résultat du batch :", result.shape)
# Multiplication matricielle par lots
batch_a = torch.randn(10, 3, 4)
batch_b = torch.randn(10, 4, 5)
result = torch.bmm(batch_a, batch_b)
print("Forme du résultat du batch :", result.shape)
Le résultat de sortie est:
批量结果形状: torch.Size([10, 3, 5])
Autres extensions