New to TorchSharp: Need help with torch.nn.Module forward method overriding #1215
-
I started one of my very first projects using TorchSharp and converting a well known example of transformer architecture to C# from Python. I've run into a bit of a roadblock while trying to override the forward method for my modules. All of my modules inherit from torch.nn.Module but cannot find any suitable method to override. The project that I created is a simple windows application in .net 8.0 and I am using the nuget package for TorchSharp 0.101.5. I guess I'm just confused on whether I should be implementing a different signature for the Module class or if this is truly a bug. I'd really appreciate any help that anyone can offer to get this project moving again. ` namespace BigramCommunicationNNModel.Model
}` |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You need to inherit from Module<Tensor, Tensor> Then your inheriting class will have forward method to override class SomeClass: Module<Tensor, Tensor>
{
public SomeClass(string name) : base(name)
{
} |
Beta Was this translation helpful? Give feedback.
You need to inherit from Module<Tensor, Tensor>
Then your inheriting class will have forward method to override