From 678d44a7f6b9e97cd21b2714ef39940424d79560 Mon Sep 17 00:00:00 2001 From: Laurent Mazare Date: Sun, 18 Feb 2024 10:35:01 +0100 Subject: [PATCH] Expose the weights and biases in transposed convolutions. (#1727) --- candle-nn/src/conv.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/candle-nn/src/conv.rs b/candle-nn/src/conv.rs index 6734ab1f85..cc9273ca9a 100644 --- a/candle-nn/src/conv.rs +++ b/candle-nn/src/conv.rs @@ -109,6 +109,14 @@ impl ConvTranspose1d { pub fn config(&self) -> &ConvTranspose1dConfig { &self.config } + + pub fn weight(&self) -> &Tensor { + &self.weight + } + + pub fn bias(&self) -> Option<&Tensor> { + self.bias.as_ref() + } } impl crate::Module for ConvTranspose1d { @@ -258,6 +266,14 @@ impl ConvTranspose2d { pub fn config(&self) -> &ConvTranspose2dConfig { &self.config } + + pub fn weight(&self) -> &Tensor { + &self.weight + } + + pub fn bias(&self) -> Option<&Tensor> { + self.bias.as_ref() + } } impl crate::Module for ConvTranspose2d {