copapy.eye#

copapy.eye(rows, cols=None)#

Create an identity tensor with ones on diagonal.

Parameters:
  • rows (int) – Number of rows.

  • cols (int | None) – Number of columns (defaults to rows).

Return type:

tensor[int]

Returns:

A 2D identity tensor.