Skip to content
Discussion options

You must be logged in to vote

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 …

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@laggui
Comment options

@chrishulbert
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@chrishulbert
Comment options

Answer selected by chrishulbert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants