mirror of
https://github.com/huggingface/candle.git
synced 2025-06-19 19:58:35 +00:00
Add Efficientnet (#572)
* EfficientNet. * Complete the efficientnet implementation. * Improve group handling. * Get the efficientnet to work.
This commit is contained in:
@ -124,7 +124,11 @@ pub fn conv1d(
|
||||
vs: crate::VarBuilder,
|
||||
) -> Result<Conv1d> {
|
||||
let init_ws = crate::init::DEFAULT_KAIMING_NORMAL;
|
||||
let ws = vs.get_or_init((out_channels, in_channels, kernel_size), "weight", init_ws)?;
|
||||
let ws = vs.get_or_init(
|
||||
(out_channels, in_channels / cfg.groups, kernel_size),
|
||||
"weight",
|
||||
init_ws,
|
||||
)?;
|
||||
let bound = 1. / (in_channels as f64).sqrt();
|
||||
let init_bs = crate::Init::Uniform {
|
||||
lo: -bound,
|
||||
@ -143,7 +147,12 @@ pub fn conv2d(
|
||||
) -> Result<Conv2d> {
|
||||
let init_ws = crate::init::DEFAULT_KAIMING_NORMAL;
|
||||
let ws = vs.get_or_init(
|
||||
(out_channels, in_channels, kernel_size, kernel_size),
|
||||
(
|
||||
out_channels,
|
||||
in_channels / cfg.groups,
|
||||
kernel_size,
|
||||
kernel_size,
|
||||
),
|
||||
"weight",
|
||||
init_ws,
|
||||
)?;
|
||||
@ -165,7 +174,12 @@ pub fn conv2d_no_bias(
|
||||
) -> Result<Conv2d> {
|
||||
let init_ws = crate::init::DEFAULT_KAIMING_NORMAL;
|
||||
let ws = vs.get_or_init(
|
||||
(out_channels, in_channels, kernel_size, kernel_size),
|
||||
(
|
||||
out_channels,
|
||||
in_channels / cfg.groups,
|
||||
kernel_size,
|
||||
kernel_size,
|
||||
),
|
||||
"weight",
|
||||
init_ws,
|
||||
)?;
|
||||
|
Reference in New Issue
Block a user