mlx.core.kron

目錄

mlx.core.kron#

kron(a: array, b: array, *, stream: None | Stream | Device = None) array#

Compute the Kronecker product of two arrays a and b.

參數:
  • a (array) -- The first input array.

  • b (array) -- The second input array.

  • stream (Union[None, Stream, Device], optional) -- Optional stream or device for execution. Default: None.

回傳:

The Kronecker product of a and b.

回傳型別:

array

範例

>>> a = mx.array([[1, 2], [3, 4]])
>>> b = mx.array([[0, 5], [6, 7]])
>>> result = mx.kron(a, b)
>>> print(result)
array([[0, 5, 0, 10],
       [6, 7, 12, 14],
       [0, 15, 0, 20],
       [18, 21, 24, 28]], dtype=int32)