flux#
- class diffsptk.Flux(lag=1, norm=2, reduction='mean')[source]#
Flux calculation module.
- Parameters:
- lagint
Lag of the distance calculation, \(L\).
- normint or float
Order of norm.
- reduction[‘none’, ‘mean’, ‘batchmean’, ‘sum’]
Reduction type.
- forward(x, y=None)[source]#
Calculate flux, which is the distance between adjacent frames.
- Parameters:
- xTensor [shape=(…, N, D)]
Input.
- yTensor [shape=(…, N, D)] or None
Target (optional).
- Returns:
- outTensor [shape=(…, N-|L|) or scalar]
Flux.
Examples
>>> x = diffsptk.ramp(5).view(3, 2) >>> x tensor([[0., 1.], [2., 3.], [4., 5.]]) >>> flux = diffsptk.Flux(reduction="none", norm=1) >>> f = flux(x) >>> f tensor([4., 4.])
- diffsptk.functional.flux(x, y=None, lag=1, norm=2, reduction='mean')[source]#
Calculate flux.
- Parameters:
- xTensor [shape=(…, N, D)]
Input.
- yTensor [shape=(…, N, D)] or None
Target (optional).
- lagint
Lag of the distance calculation, \(L\).
- normint or float
Order of norm.
- reduction[‘none’, ‘mean’, ‘batchmean’, ‘sum’]
Reduction type.
- Returns:
- outTensor [shape=(…, N-|L|) or scalar]
Flux.
See also