ord defines the norm that is computed. The following norms are supported:

+------------------------+---------------------------+---------------------------------+ | ord | norm for matrices | norm for vectors | +========================+===========================+=================================+ | NULL (default) | Frobenius norm | 2-norm (see below) | +------------------------+---------------------------+---------------------------------+ | "fro" | Frobenius norm | -- not supported -- | +------------------------+---------------------------+---------------------------------+ | "nuc" | nuclear norm | -- not supported -- | +------------------------+---------------------------+---------------------------------+ | Inf | max(sum(abs(x), dim=2)) | max(abs(x)) | +------------------------+---------------------------+---------------------------------+ | -Inf | min(sum(abs(x), dim=2)) | min(abs(x)) | +------------------------+---------------------------+---------------------------------+ | 0 | -- not supported -- | sum(x != 0) | +------------------------+---------------------------+---------------------------------+ | 1 | max(sum(abs(x), dim=1)) | as below | +------------------------+---------------------------+---------------------------------+ | -1 | min(sum(abs(x), dim=1)) | as below | +------------------------+---------------------------+---------------------------------+ | 2 | largest singular value | as below | +------------------------+---------------------------+---------------------------------+ | -2 | smallest singular value | as below | +------------------------+---------------------------+---------------------------------+ | other int or float | -- not supported -- | sum(abs(x)^{ord})^{(1 / ord)} | +------------------------+---------------------------+---------------------------------+



Try the torch package in your browser

Any scripts or data that you put into this service are public.

torch documentation built on June 7, 2023, 6:19 p.m.