@@ -444,11 +444,12 @@ def dht(x: Tensor, dht_type: int = 2) -> Tensor:
444444
445445def drc (
446446 x : Tensor ,
447+ * ,
448+ sample_rate : int ,
447449 threshold : float ,
448450 ratio : float ,
449451 attack_time : float ,
450452 release_time : float ,
451- sample_rate : int ,
452453 makeup_gain : float = 0 ,
453454 abs_max : float = 1 ,
454455) -> Tensor :
@@ -459,6 +460,9 @@ def drc(
459460 x : Tensor [shape=(..., T)]
460461 The input waveform.
461462
463+ sample_rate : int >= 1
464+ The sample rate in Hz.
465+
462466 threshold : float <= 0
463467 The threshold in dB.
464468
@@ -471,9 +475,6 @@ def drc(
471475 release_time : float > 0
472476 The release time in msec.
473477
474- sample_rate : int >= 1
475- The sample rate in Hz.
476-
477478 makeup_gain : float >= 0
478479 The make-up gain in dB.
479480
@@ -571,36 +572,27 @@ def dtw(
571572 )
572573
573574
574- def dtw_merge (x : Tensor , y : Tensor , indices : Tensor ) -> tuple [ Tensor , Tensor ] :
575- """Align two vector sequences according to the given path .
575+ def dtw_merge (x : Tensor , y : Tensor , indices : Tensor ) -> Tensor :
576+ """Merge two sequences according to the given indices .
576577
577578 Parameters
578579 ----------
579- x : Tensor [shape=(T1, ... )]
580+ x : Tensor [shape=(T1, D) or (T1, )]
580581 The query vector sequence.
581582
582- y : Tensor [shape=(T2, ... )]
583+ y : Tensor [shape=(T2, D) or (T2, )]
583584 The reference vector sequence.
584585
585586 indices : Tensor [shape=(T, 2)]
586- The indices of the path.
587+ The indices of the viterbi path.
587588
588589 Returns
589590 -------
590- x_align : Tensor [shape=(T, ...)]
591- The aligned query vector sequence.
592-
593- y_align : Tensor [shape=(T, ...)]
594- The aligned reference vector sequence.
591+ z : Tensor [shape=(T, 2D) or (T, 2)]
592+ The merged vector sequence.
595593
596594 """
597- if x .dim () != y .dim ():
598- raise ValueError ("x and y must have the same number of dimensions." )
599- if indices .dim () != 2 or indices .size (- 1 ) != 2 :
600- raise ValueError ("The shape of indices must be (T, 2)." )
601- x_align = x [indices [:, 0 ]]
602- y_align = y [indices [:, 1 ]]
603- return x_align , y_align
595+ return nn .DynamicTimeWarping .merge (x = x , y = y , indices = indices )
604596
605597
606598def entropy (p : Tensor , out_format : str = "nat" ) -> Tensor :
0 commit comments