Performs the outer-product of vectors vec1
and vec2
and adds it to the matrix input
.
Optional values beta
and alpha
are scaling factors on the outer product between vec1
and vec2
and the added matrix input
respectively.
out = β input + α ( vec1 ⊗ vec2 ) \text{out} = \beta\ \text{input} + \alpha\ (\text{vec1} \otimes \text{vec2}) out=β input+α (vec1⊗vec2)
If beta
is 0, then the content of input
will be ignored, and nan and inf in it will not be propagated.
If vec1
is a vector of size n and vec2
is a vector of size m, then input
must be broadcastable with a matrix of size ( n × m ) (n \times m) (n×m) and out
will be a matrix of size ( n × m ) (n \times m) (n×m).
beta (Number, optional) – multiplier for input
( β \beta β)
alpha (Number, optional) – multiplier for vec1 ⊗ vec2 \text{vec1} \otimes \text{vec2} vec1⊗vec2 ( α \alpha α)
out (Tensor, optional) – the output tensor.
Example:
>>> vec1 = torch.arange(1., 4.) >>> vec2 = torch.arange(1., 3.) >>> M = torch.zeros(3, 2) >>> torch.addr(M, vec1, vec2) tensor([[ 1., 2.], [ 2., 4.], [ 3., 6.]])
Access comprehensive developer documentation for PyTorch
View Docs TutorialsGet in-depth tutorials for beginners and advanced developers
View Tutorials ResourcesFind development resources and get your questions answered
View ResourcesRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4