import torch


def quadratic_bezier(params: torch.Tensor, t: torch.Tensor) -> torch.Tensor:
    """Evaluate a batch of quadratic bezier curves at different points.

    Args:
      params: torch.Tensor of size [batch, 3, D]. Each batch item is interpreted as four points corresponding to
        the start point, the first control point, the second control point and the end point. D is the number of
        dimensions.
      t: torch.Tensor of size [batch, nvalues, 1] or [nvalues, 1] that defines the values of t to evaluate the
        curve at.

    Returns:
      a torch.Tensor of size [batch, nvalues, D] representing the points along each curve in the batch at the
      respective values of t.

    """
    p0 = params[:, 0].unsqueeze(1)
    p1 = params[:, 1].unsqueeze(1)
    p2 = params[:, 2].unsqueeze(1)

    return (1 - t) ** 2 * p0 + 2 * (1 - t) * t * p1 + t ** 2 * p2