Skip to content

Instantly share code, notes, and snippets.

@dhruvbird
Last active November 12, 2021 19:25
Show Gist options
  • Save dhruvbird/4c6347e83e43e4ee1a1a11f7bddd46dd to your computer and use it in GitHub Desktop.
Save dhruvbird/4c6347e83e43e4ee1a1a11f7bddd46dd to your computer and use it in GitHub Desktop.
Simple Python code to create a very simple model
import torch
class AddTensorsModel(torch.nn.Module):
def __init__(self):
super().__init__();
self.t1 = torch.Tensor([0, 5, 10])
def helper(self, x, y):
z = self.t1
z = z + x + y
return z
def forward(self, x, y):
return self.helper(x, y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment