mlx.core.identity# identity(n: int, dtype: Dtype | None = float32, *, stream: None | Stream | Device = None) → array# 创建一个方阵单位矩阵。 参数: n (int) – 输出中的行数和列数。 dtype (Dtype, optional) – 输出数组的数据类型。默认为 float32。 stream (Stream, optional) – 流或设备。默认为 None。 返回: 一个大小为 n x n 的单位矩阵。 返回类型: array