Replies: 2 comments
-
@nathanielsimard would know of this limitation. Is this expected? Should we file an issue ticket for this? |
Beta Was this translation helpful? Give feedback.
0 replies
-
This is supported, you just have to avoid specifying the trait bounds in the module definition, but rather in the implementation block: use burn::prelude::*;
use core::marker::PhantomData;
trait HasForward<B: Backend> {
fn forward<const D: usize>(&self, input: Tensor<B, D>) -> Tensor<B, D>;
}
#[derive(Module, Debug)]
pub struct AcrossDim<B: Backend, L> {
modules: Vec<L>
_backend: PhantomData<B>,
}
impl<B: Backend, L: HasForward<B>> AcrossDim<B, L> {
// implementation goes here
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to create a module that can contain other modules that implement a trait. Is there a way to do that?
Something like the following, but it gives errors. I tried to add some associated type bounds but then the proc-macro panicked (unexpected token).
Error:
Beta Was this translation helpful? Give feedback.
All reactions