linalg_vector_norm¶
Computes the vector \(p\)-norm along one or more axes:
\[\lVert x \rVert_p = \left( \sum_i \lvert x_i \rvert^{p} \right)^{1/p}\]
For ord = +inf / -inf, the sum is replaced by max / min over the reduced axes.
ATen source: aten.linalg_vector_norm
Inputs¶
Name |
Description |
|---|---|
|
Input tensor |
Attributes¶
Name |
Type |
Description |
|---|---|---|
|
|
Order of the norm. |
|
|
Dims to reduce. |
|
|
If |
|
|
Composite op version |
Output¶
Name |
Description |
|---|---|
|
Input shape with reduced dims either set to |
PyTorch example¶
import torch
input = torch.randn(8, 128, 256, 1024)
# Note: the PyTorch arg is `dim`; Core AI's IR attribute is `axes`
output = torch.linalg.vector_norm(input, ord=-1.5, dim=[1, 3], keepdim=False)
# Output shape: (8, 256)