Pytorch Torch Matrix_Power
# PyTorch torch.matrix_power Function
* * PyTorch torch Reference Manual](#)
`torch.matrix_power` is a function in PyTorch used to compute the power of a matrix.
### Function Definition
torch.matrix_power(input, n)
* * *
## Usage Example
## Example
import torch
# Create a square matrix
A = torch.tensor([[1.0,2.0],[3.0,4.0]])
# Compute the 3rd power of the matrix
A_power = torch.matrix_power(A,3)
print("Matrix Power:")
print(A_power)
* * PyTorch torch Reference Manual](#)
YouTip