Merge items().
Id like to have access to model.items(), iterate over them and add value and the key as follows:
this[key] = value
if this.Keys contain key{ this[key] = (this[key] + value) / 2 }
to have two models merged.
this <- nn.module
I would use index_select() to get tensors by index, apply transformations and copy back with index_put().
https://pytorch.org/docs/stable/generated/torch.index_select.html
No such method like index_select or index_put in torchsharp.
On Tue, May 6, 2025 at 1:34 PM Mateusz Wolnica @.***> wrote:
Are you able to send me the code ?
On Tue, May 6, 2025, 08:34 Andreas Schönebeck @.***> wrote:
andyesys left a comment (dotnet/TorchSharp#1474) https://github.com/dotnet/TorchSharp/issues/1474#issuecomment-2853428356
I would use index_select() to get tensors by index, apply transformations and copy back with index_put().
https://pytorch.org/docs/stable/generated/torch.index_select.html
— Reply to this email directly, view it on GitHub https://github.com/dotnet/TorchSharp/issues/1474#issuecomment-2853428356, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIKTKLEUJFSXK22GWW6UC5L25BJYJAVCNFSM6AAAAAB4PLOFNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNJTGQZDQMZVGY . You are receiving this because you authored the thread.Message ID: @.***>
No such method like index_select or index_put in torchsharp.
I have read your initial question again and just figured out, that you want to merge submodels. Sorry I can't help you with that.
The functions I mentioned, index_select() etc. only apply to tensors.