PyTorch torch.bmm-Funktion
PyTorch torch Referenzhandbuch
torch.bmmist eine Funktion in PyTorch, die zur Durchführung der Batch-Matrixmultiplikation verwendet wird.
Funktionsdefinition
torch.bmm(input, mat2, out)
Anwendungsbeispiel
Beispiel
import torch
# Batch-Matrixmultiplikation
batch_a = torch.randn(10, 3, 4)
batch_b = torch.randn(10, 4, 5)
result = torch.bmm(batch_a, batch_b)
print("Batch-Ergebnisform:", result.shape)
# Batch-Matrixmultiplikation
batch_a = torch.randn(10, 3, 4)
batch_b = torch.randn(10, 4, 5)
result = torch.bmm(batch_a, batch_b)
print("Batch-Ergebnisform:", result.shape)
Das Ausgabeergebnis ist:
批量结果形状: torch.Size([10, 3, 5])
Andere Erweiterungen