HCareLou

Results 31 comments of HCareLou

Will all attributes be made available in the future?

Thank you both very much for your efforts, I believe that TorchSharp will become even more powerful.

I am very happy to see this proposal.

I suspect it's because of this API that it fails to recognize all the modules. this.add_module(nameof(model), this.model);

![image](https://github.com/dotnet/TorchSharp/assets/55724885/303ab0db-a139-4f96-bea6-3a24f3e0a18d) ![image](https://github.com/dotnet/TorchSharp/assets/55724885/2d94577f-a355-4547-9921-e3b780b9fa03) When the elements of ModuleList are nn.Module instead of nn.Sequential, the state_dict of the ModuleList elements can be captured correctly.

When calling `model.add_module`, it traverses its sub-items and calls `RegisterComponents()` for each sub-item. However, `Sequential` does not perform such an operation. As a temporary measure, in a custom model, after...

Comparing Sequential and ModuleList, it can be observed that ModuleList overrides RegisterComponents, whereas Sequential does not. Because ModuleList overrides RegisterComponents, it gains the ability to automatically invoke the RegisterComponents of...

``` public class AModel : TorchSharp.torch.nn.Module { public TorchSharp.Modules.Sequential cv1; public TorchSharp.Modules.ModuleList cv2; public AModel():base(nameof(AModel)) { cv1 = nn.Sequential(Enumerable.Range(0, 3).Select(x => new BModel())); cv2 = nn.ModuleList(Enumerable.Range(0, 3).Select(x => new BModel()).ToArray());...

Sequential and ModuleList have different implementation methods for RegisterComponents.