mirror of
https://github.com/huggingface/candle.git
synced 2025-06-19 19:58:35 +00:00
Add a simple Module trait and implement it for the various nn layers (#500)
* Start adding the module trait. * Use the module trait. * Implement module for qmatmul.
This commit is contained in:
@ -34,8 +34,10 @@ impl GroupNorm {
|
||||
num_groups,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn forward(&self, x: &Tensor) -> Result<Tensor> {
|
||||
impl crate::Module for GroupNorm {
|
||||
fn forward(&self, x: &Tensor) -> Result<Tensor> {
|
||||
let x_shape = x.dims();
|
||||
if x_shape.len() <= 2 {
|
||||
candle::bail!("input rank for GroupNorm should be at least 3");
|
||||
|
Reference in New Issue
Block a user