forked from ccf-ai-infra/GPUCodeForces
26 lines
571 B
Python
26 lines
571 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:
|
|
"""
|
|
Input: (N, C, H, W)
|
|
Output: (N, C, H, W), Softmax along dim=1 (C)
|
|
"""
|
|
return F.softmax(x, dim=1)
|
|
|
|
batch_size = 32
|
|
channels = 64
|
|
height = 128
|
|
width = 128
|
|
|
|
def get_inputs():
|
|
x = torch.randn(batch_size, channels, height, width, dtype=torch.float32)
|
|
return [x]
|
|
|
|
def get_init_inputs():
|
|
return [] |