From 4352a16f575f35637c305f0b635a5a89d98cc955 Mon Sep 17 00:00:00 2001 From: Daniel Povey Date: Mon, 6 Jun 2022 17:43:15 +0800 Subject: [PATCH] Fix bug that relates to modifying U in place --- egs/librispeech/ASR/pruned_transducer_stateless2/scaling.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/egs/librispeech/ASR/pruned_transducer_stateless2/scaling.py b/egs/librispeech/ASR/pruned_transducer_stateless2/scaling.py index 25e3fdccb..7fbbe55c6 100644 --- a/egs/librispeech/ASR/pruned_transducer_stateless2/scaling.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless2/scaling.py @@ -668,11 +668,11 @@ class RandProjDrop(torch.nn.Module): else: self._randomize_U() x = x.transpose(self.channel_dim, -1) # (..., num_channels) - - x = torch.matmul(x, self.U) + U = self.U.clone() + x = torch.matmul(x, U) x = torch.nn.functional.dropout(x, self.dropout_rate, training=True) - x = torch.matmul(x, self.U.t()) + x = torch.matmul(x, U.t()) x = x.transpose(self.channel_dim, -1) # (..., num_channels) return x