Method norm
static member norm: Tensor<'T> * 'T option -> 'T
Calculates the norm of the (flattened) tensor.
Declaration
static member norm: a:Tensor<'T> * ord:'T option -> 'T
Parameters
Type | Name | Description |
---|---|---|
Tensor<'T> | a | The tensor containing the source values. |
'T option | ord | The order (power) of the norm. (default: 2) |
Returns
Type | Description |
---|---|
'T | A new tensor containing the result of this operation. |
Remarks
The norm is calculated over all elements of the tensor.
It is defined by sqrt (sum_i (x_i**ord))
.
Examples
let a = HostTensor.ofList2D [[1.0; 2.0; 3.0; 4.0]
[5.0; 6.0; 7.0; 8.0]]
let b = Tensor.norm a // 14.283