GPUCodeForces/S1/uucoco_#79/BehaviorCloningLoss_torch.py

23 lines
381 B
Python

import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
def forward(self, log_probs: torch.Tensor) -> torch.Tensor:
loss = -log_probs.mean()
return loss
batch_size = 256
def get_inputs():
log_probs = torch.randn(batch_size)
return [log_probs]
def get_init_inputs():
return []