Type error around "ItemValid = OutputValid" that I just cannot find a way to resolve, if i may beg for help :) #3585
-
Hi! I've been trying to use Burn to do some ML on time series data, and have been hitting a problem with types that i just cannot resolve. Compilation fails on this line: learner.fit(training_dataloader, validation_dataloader) The error boils down to a type mismatch involving "ItemValid = OutputValid". I've tried many things to get this to work, such as changing the validation_dataloader to use the Autodiff-wrapped backend, removing explicit types, etc etc but i still get basically the same error. Could anyone please point me in the right direction? Here's the full code that i've stripped back to the essentials, and the full error is below that:
Full error:
For more information about this error, try Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Also, i tried following the discord link at the top of burn.dev however it says the invite is invalid/may be expired. I'd love to join if possible! Thanks :) |
Beta Was this translation helpful? Give feedback.
-
I was able to resolve this by starting from the 'guide' sample code and copy in my file one function at a time and get it to work that way. However I never really understood the original error, i'm curious if anyone has advice. Maintainers may feel free to close this however as the immediate need is over. Thanks! |
Beta Was this translation helpful? Give feedback.
-
The compiler is usually able to infer most types based on the types you provide, but in this case you actually specified each generic explicitly and the valid output was incorrect: type MyModule = Model<MyAutodiffBackend>;
type MyOptimizer = OptimizerAdaptor<Adam, MyModule, MyAutodiffBackend>;
type MyOutput = ClassificationOutput<MyAutodiffBackend>;
+ type MyOutputVal = ClassificationOutput<MyBackend>;
let learner_builder = LearnerBuilder::<
MyAutodiffBackend,
MyOutput,
- MyOutput,
+ MyOutputVal,
MyModule,
MyOptimizer,
f64>::new(".");
let learner = learner_builder.build(model, AdamConfig::new().init(), 1.0e-3); The validation output should not be on the autodiff backend 🙂 |
Beta Was this translation helpful? Give feedback.
The compiler is usually able to infer most types based on the types you provide, but in this case you actually specified each generic explicitly and the valid output was incorrect:
The …