import torch
import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):
    def __init__(self, target):
        super(Model, self).__init__()
        self.target = nn.Parameter(target)

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        fx = x * x
        ft = self.target * self.target
        grad_ft = 2.0 * self.target

        bregman = fx - ft - grad_ft * (x - self.target)
        dist = torch.sum(bregman, dim=-1)
        return F.gelu(dist)


batch_size = 128
input_dim = 1024


def get_inputs():
    x = torch.randn(batch_size, input_dim)
    return [x]


def get_init_inputs():
    target = torch.randn(input_dim)
    return [target]