copapy.diagonal# copapy.diagonal(vec)# Overloads: vec (tensor[int] | vector[int]) → tensor[int] vec (tensor[float] | vector[float]) → tensor[float] Create a diagonal tensor from a 1D tensor. Parameters: vec (tensor[Any] | vector[Any]) – A 1D tensor with values to place on the diagonal. Returns: A 2D tensor with the input values on the diagonal and zeros elsewhere.