forked from karpathy/autoresearch
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreference.py
More file actions
32 lines (25 loc) · 796 Bytes
/
reference.py
File metadata and controls
32 lines (25 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that performs a single square matrix multiplication (C = A * B)
"""
def __init__(self):
super(Model, self).__init__()
def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor:
"""
Performs the matrix multiplication.
Args:
A (torch.Tensor): Input matrix A of shape (N, N).
B (torch.Tensor): Input matrix B of shape (N, N).
Returns:
torch.Tensor: Output matrix C of shape (N, N).
"""
return torch.matmul(A, B)
N = 2048 * 2
def get_inputs():
A = torch.rand(N, N)
B = torch.rand(N, N)
return [A, B]
def get_init_inputs():
return [] # No special initialization inputs needed