forked from ccf-ai-infra/GPUCodeForces
21 lines
501 B
Python
21 lines
501 B
Python
import torch
|
|
import torch.nn as nn
|
|
import torch.nn.functional as F
|
|
|
|
class Model(nn.Module):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
|
g1, x1, g2, x2 = x.chunk(4, dim=-1)
|
|
return torch.cat([torch.sigmoid(g1) * x1, torch.sigmoid(g2) * x2], dim=-1)
|
|
|
|
batch_size = 128
|
|
feature_dim = 4096
|
|
|
|
def get_inputs():
|
|
x = torch.randn(batch_size, feature_dim, dtype=torch.float32)
|
|
return [x]
|
|
|
|
def get_init_inputs():
|
|
return [] |