forked from ccf-ai-infra/GPUCodeForces
21 lines
466 B
Python
21 lines
466 B
Python
import torch
|
|
import torch.nn as nn
|
|
|
|
class Model(nn.Module):
|
|
def __init__(self, in_features):
|
|
super().__init__()
|
|
torch.manual_seed(42)
|
|
self.linear = nn.Linear(in_features, in_features)
|
|
|
|
def forward(self, x):
|
|
x = self.linear(x)
|
|
return x - torch.tanh(x)
|
|
|
|
def get_inputs():
|
|
batch_size = 2048
|
|
in_features = 1024
|
|
x = torch.randn(batch_size, in_features)
|
|
return [x]
|
|
|
|
def get_init_inputs():
|
|
return [1024] |