You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
May not related to this issue, but actually I suppose that we shall reconsider about the submodules, especially the way we register them. Actually we have discussed this before here. I think the best approach would be to use source generators. But it will true add too much complexity, so previously we just consider it as a last resort and put it on hold. #1272 (comment)
Hey @brianberns, thanks for the issue. I tested it myself and you are right, there seems to be a problem with the Sequential module. For the moment, would you try creating and using your own custom module containing the Sequential module as specified in the wiki here ? Meaning something like this:
public class CustomModel : Module<Tensor, Tensor>
{
private readonly Module<Tensor, Tensor> layers;
public CustomModel()
: base("CustomModel")
{
var modules = new List<(string, Module<Tensor, Tensor>)>();
modules.Add(("lin1", Linear(10, 10)));
layers = Sequential(modules);
RegisterComponents();
}
public override Tensor forward(Tensor input)
{
return layers.forward(input);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
layers.Dispose();
}
base.Dispose(disposing);
}
}
Calling
eval()
should maketraining
false. However, this does not work forSequential
modules.Example F# program:
I think the problem is that
Sequential.train()
should callbase.train()
in addition to callingtrain()
for each submodule:The text was updated successfully, but these errors were encountered: