From e6697471bb96a58a82b9a5ed71cb44b72e1564b2 Mon Sep 17 00:00:00 2001 From: jwnz Date: Fri, 10 Nov 2023 00:09:01 +0900 Subject: [PATCH] Add weight and bias functions to LayerNorm (#1306) --- candle-nn/src/layer_norm.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/candle-nn/src/layer_norm.rs b/candle-nn/src/layer_norm.rs index 7617fc6c..26800a7b 100644 --- a/candle-nn/src/layer_norm.rs +++ b/candle-nn/src/layer_norm.rs @@ -95,6 +95,14 @@ impl LayerNorm { eps, } } + + pub fn weight(&self) -> &Tensor { + &self.weight + } + + pub fn bias(&self) -> Option<&Tensor> { + self.bias.as_ref() + } } impl crate::Module for LayerNorm {