forked from ccf-ai-infra/GPUCodeForces
24 lines
451 B
Python
24 lines
451 B
Python
import torch
|
|
import torch.nn as nn
|
|
|
|
|
|
class Model(nn.Module):
|
|
def __init__(self, b=0.0):
|
|
super().__init__()
|
|
self.b = b
|
|
|
|
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
|
return torch.where(x > 0, x + self.b, self.b)
|
|
|
|
|
|
batch_size = 128
|
|
feature_dim = 512
|
|
|
|
|
|
def get_inputs():
|
|
x = torch.randn(batch_size, feature_dim, dtype=torch.float32)
|
|
return [x]
|
|
|
|
|
|
def get_init_inputs():
|
|
return [0.0] |