# tensorplay.functional.kron Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.kron.html ```python tensorplay.functional.kron(input, other, *, out=None) → Tensor ``` Computes the Kronecker product, denoted by $\otimes$, of input and other. If input is a $(a_0 \times a_1 \times \dots \times a_n)$ tensor and other is a $(b_0 \times b_1 \times \dots \times b_n)$ tensor, the result will be a $(a_0*b_0 \times a_1*b_1 \times \dots \times a_n*b_n)$ tensor with the following entries: $$(\text{input} \otimes \text{other})_{k_0, k_1, \dots, k_n} = \text{input}_{i_0, i_1, \dots, i_n} * \text{other}_{j_0, j_1, \dots, j_n},$$ where $k_t = i_t * b_t + j_t$ for $0 \leq t \leq n$. If one tensor has fewer dimensions than the other it is unsqueezed until it has the same number of dimensions. Supports real-valued and complex-valued inputs. > **Note** > > This function generalizes the typical definition of the Kronecker product for two matrices to two tensors, as described above. When input is a $(m \times n)$ matrix and other is a $(p \times q)$ matrix, the result will be a $(p*m \times q*n)$ block matrix: @@TPBLOCK_2@@ where input is $\mathbf{A}$ and other is $\mathbf{B}$. Parameters: - input ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) - other ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) Keyword Arguments: out ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor), optional) – The output tensor. Ignored if None. Default: None Examples: ``` >>> mat1 = tensorplay.eye(2) >>> mat2 = tensorplay.ones(2, 2) >>> tensorplay.kron(mat1, mat2) tensor([[1., 1., 0., 0.], [1., 1., 0., 0.], [0., 0., 1., 1.], [0., 0., 1., 1.]]) >>> mat1 = tensorplay.eye(2) >>> mat2 = tensorplay.arange(1, 5).reshape(2, 2) >>> tensorplay.kron(mat1, mat2) tensor([[1., 2., 0., 0.], [3., 4., 0., 0.], [0., 0., 1., 2.], [0., 0., 3., 4.]]) ```