cupy.identity#

cupy.identity(n, dtype=<class 'float'>)[source]#

Returns a 2-D identity array.

It is equivalent to eye(n, n, dtype).

Parameters:
  • n (int) – Number of rows and columns.

  • dtype (data-type, optional) – Data type specifier.

Returns:

A 2-D identity array.

Return type:

cupy.ndarray

See also

numpy.identity()