How should I write a key remap for an enum type? #1662
-
I'm getting an error with my current code. #[derive(Module, Debug)]
pub enum Layers<B: Backend> {
Conv2d(Conv2d<B>),
BatchNorm(BatchNorm<B, 2>),
ConvTranspose2d(ConvTranspose2d<B>),
}
#[derive(Module, Debug)]
pub struct DownSample<B: Backend> {
layers: Vec<Layers<B>>,
}
LoadArgs::new(model_path.into())
.with_key_remap("downsample.0", "downsample.layers.0.Conv2d")
.with_key_remap("downsample.1", "downsample.layers.1.BatchNorm") This is apart of key remap info.
|
Beta Was this translation helpful? Give feedback.
Answered by
zemelLeong
Apr 19, 2024
Replies: 1 comment 1 reply
-
It seems that no special handling is required for enums. LoadArgs::new(model_path.into())
.with_key_remap("downsample.0", "downsample.layers.0")
.with_key_remap("downsample.1", "downsample.layers.1") |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
zemelLeong
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that no special handling is required for enums.