GPUCodeForces/S1/uucoco_#40/PReLU_torch.py

22 lines
521 B
Python

import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, num_features=64, init=0.25):
super().__init__()
self.act = nn.PReLU(num_parameters=num_features, init=init)
def forward(self, x: torch.Tensor) -> torch.Tensor:
return self.act(x)
batch_size = 128
num_features = 64
height = 64
width = 64
def get_inputs():
x = torch.randn(batch_size, num_features, height, width, dtype=torch.float32)
return [x]
def get_init_inputs():
return [num_features, 0.25]